2022-12-28

Android app xml resources with variable in it?

Is there a technique to implement the Android app xml resources with variable in it?

For example: I have a app resource, i.e., res/drawable/rounded_corners.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <solid android:color="@android:color/holo_blue_dark" />
    <corners android:radius="10dp" />
</shape>

It works, but I need to change the color in the runtime without creating a lot of similar resources like this just with different colors.



No comments:

Post a Comment