Consider the following vector-based drawable resource...
@drawable/icon_circled_plus:
<?xml version="1.0" encoding="UTF-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="circledMinus"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:name="border"
android:pathData="M 124,64 C 124,97.14 97.14,124 64,124 C 30.86,124 4,97.14 4,64 C 4,44.43 13.37,27.04 27.87,16.09 C 37.92,8.5 50.44,4 64,4 C 97.14,4 124,30.86 124,64 Z"
android:fillColor="#0000FF"
android:strokeColor="#0000FF"
android:strokeWidth="8" />
<path
android:name="glyph"
android:pathData="M 24,71 L 104,71 L 104,57 L 24,57 L 24,71 Z"
android:fillColor="#FFFFFF" />
</vector>
I know I can use it in my layout files like so:
<ImageView
android:id="@+id/mainImageView"
android:layout_width="match_parent"
android:layout_height="32dp"
android:src="@drawable/icon_circled_plus" />
My question is how can I programmatically access the individual elements in the drawable so I can modify them in code?
For instance, 'border' has both a fill and stroke color of blue. What if I wanted to change them to red based on some application logic? Can this be done without having to convert this to custom-drawing or creating multiple drawable resources?