<?xml version="1.0" enCoding="utf-8"?><shape xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:shape="oval"> <solID androID:color="#00000000"/> <padding androID:left="30dp" androID:top="30dp" androID:right="30dp" androID:bottom="30dp" /> <stroke androID:color="#439CC8" androID:wIDth="7dp" /></shape>
这是我的代码:
textvIEw.setBackgroundResource(R.drawable.circle);
我想在我的java代码中更改笔触粗细.如何以编程方式更改它?
解决方法 您可能需要以编程方式创建它ShapeDrawable circle = new ShapeDrawable( new ovalShape() );
你需要在此之后设置属性,(填充,颜色等)然后改变它的笔划
circle.getPaint().setstrokeWIDth(12);
然后将其设置为视图的背景
textvIEw.setBackgroundDrawable(circle);总结
以上是内存溢出为你收集整理的如何在Android中以编程方式更改形状的笔触宽度?全部内容,希望文章能够帮你解决如何在Android中以编程方式更改形状的笔触宽度?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)