我有一个可绘制的XML文件(background.xml)绘制对象XML中:由所使用的LinearLayout在运行时改变形状纯色作为背景
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
...........
</shape>
</item>
<item android:id="@+id/shape_id">
<shape android:shape="rectangle">
<solid android:color="#ffefefef" />
</shape>
</item>
</layer-list>
:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/background"
android:id="@+id/layout_id"
>
现在我需要基于某些条件在运行时更改固体颜色shape_id
。这个怎么做?
不,我不认为这是可能的 – Raghunandan
一切皆有可能 – AndroidGecko