Tab icons: My current method is to create two files (ic_list_selected_24dp.xml and ic_list_unselected_24dp.xml; they are basically the same, but only android:fillColor='Color HEX CODE'different) and then create a selector (selector_tabitem_list.xml) to change the color with the ability to draw when the state changes.
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:drawable="@drawable/ic_list_selected_24dp"
android:state_selected="true" />
<item android:drawable="@drawable/ic_list_unselected_24dp"
android:state_selected="false" />
</selector>
This is similar to duplication because the two drawings are the same.
The selector cannot be used in vector portability.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@drawable/selector"
android:pathData="M19,3...."
</vector>
-
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<color android:color="@color/itemSelected" />
</item>
<item android:state_selected="false">
<color android:color="@color/itemUnselected" />
</item>
</selector>
and android:fillColor="@color/state".
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/white" android:state_selected="true" />
<item android:color="@android:color/black" android:state_selected="false" />
</selector>
Is it possible to use one of the available and dynamically change the color? Is hard hex code better?
Thank.