I have the following file in my dropdown folder named /drawable/mybkg.xml . I want to inflate it to change colors programmatically. Is this possible in Android?
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="oval" > <padding android:top="5dp" android:bottom="2dp" android:left="2dp" android:right="2dp" /> <solid android:angle="270" android:color="#1bd4f6" /> <stroke android:width="2dp" android:color="#121ce5" /> </shape> </item> <item> <shape android:shape="oval" > <solid android:color="#1b90f6" /> </shape> </item> </layer-list>
I just saw a class called LayerDrawable . Does anyone know how I could convert my XML file into such a LayerDrawable either by writing code or bloating existing xml?
source share