I have the following XML:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/customPlayerProgressBg">
<shape>
<gradient
android:startColor="#FF999999"
android:endColor="#FF999999"
/>
</shape>
</item>
<item android:id="@+id/customPlayerProgressSecondary">
<clip>
<shape>
<gradient
android:startColor="#FF5C3C68"
android:endColor="#FF5C3C68"
/>
</shape>
</clip>
</item>
<item
android:id="@+id/customPlayerProgress"
>
<clip>
<shape>
<gradient
android:startColor="#FF5C3C68"
android:endColor="#FF5C3C68"
/>
</shape>
</clip>
</item>
</layer-list>
I want to change the "customPlayerProgress" and the "customPlayerProgressSecondary" by Java code. How can that be accomplished?
You may be familiar with DOM. You just need to modify the change and then save the file.
Here is an article that may be of some assistance.
You can't change generated XML files at run-time.
Assuming that you want to have access to them through Java code after they are loaded as a Drawable in your app, you should be able to do something like the following:
Also look at this for some more ideas.