我正在尝试更改按钮的背景以显示正在运行的后台进程的进度。我使用的是由两种颜色组成的可绘制对象,因此现在我需要以编程方式更改以下层列表中这些<item>
的顶部和底部属性:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:bottom="20dp">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
</shape>
</item>
<item android:top="30dp">
<shape android:shape="rectangle" >
<solid android:color="#000000" />
</shape>
</item>
</layer-list>
我无法从Java代码中选择
<item>
元素并修改它们。