Create complex drawable dynamically

322 Views Asked by At

I want to create the following drawable dinamically to use it inside a Circle Progress bar:

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="720">

<shape
    android:shape="ring"
    android:innerRadiusRatio="3"
    android:thicknessRatio="8"
    android:useLevel="false">

    <gradient
        android:type="linear"
        android:useLevel="false"
        android:startColor="@android:color/transparent"
        android:centerColor="@color/colorAccent"
        android:endColor="@android:color/black"
        android:angle="45" />
</shape>

I have to create it dynamically due is required to change the startColor/centerColor/endColor in execution time.

Thanks in advance for your responses.

0

There are 0 best solutions below