I have created a vector drawable :
ic_item_overflow.xml
<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="#8b8b8b"
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
I want to use this vector drawable in 2 colors: dark grey color code #8b8b8b and white color : #FFFFFF
I've used the dark grey color code in the vector drawable file so the drawable will be shown in this color by default. I've changed the color of this vector drawable like below:
Drawable drawable = ContextCompat.getDrawable
(mContext, R.drawable.ic_item_overflow);
DrawableCompat.setTint(drawable, ContextCompat.getColor(mContext, R.color.white));
This is working fine in case of all lollipop and post lollipop devices but not working fine on prelollipop devices. What can I do to get this working in all version of android.
Please help if anyone know how to do this. Thanks a lot in advanced.