我有一个Drawable xml文件(background.xml):
<?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>
Run Code Online (Sandbox Code Playgroud)
由LinearLayout使用:
<?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"
>
Run Code Online (Sandbox Code Playgroud)
现在我需要shape_id根据某些条件在运行时更改形状纯色.这该怎么做?
我一直在写一些Android应用程序,但我真的不知道何时使用app:以及何时使用android:.当样式没有以他们应该的方式应用时,我使用试验和错误,有时发现使用app:而不是android:解决问题,但我不明白为什么.如果有人能指出我正确的方向,那就太棒了.谢谢!