我的可绘制文件夹中有一个 XML 文件。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:padding="10dp">
<solid android:color="#2A3B5E"/>
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
</shape>
我想更改颜色值。是否可以通过编程方式更改该值?
最佳答案
已回答 here !
它检索包含要修改的可绘制形状的背景;否则,您可以通过编程方式实例化一个新的 ShapeDrawable
,并分配您喜欢的所有属性。
关于java - 在 Android 中以编程方式更改颜色值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33172404/