Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我有这个代码:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="1dip" android:color="#000000"/> </shape>
如何更改 的值android:color?
android:color
谢谢
您可以在运行时创建它,然后随时更改它:
RoundRectShape rect = new RoundRectShape( new float[] {30,30, 30,30, 30,30, 30,30}, null, null); ShapeDrawable bg = new ShapeDrawable(rect); bg.getPaint.setColor(0x99FFFFFF); view.setBackgroundDrawable(bg);