<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item>
<selector>
<item android:state_selected="true">
<layer-list>
<item android:left="-5dp"
android:top="-5dp"
android:right="-5dp">
<shape android:shape="rectangle">
<stroke android:width="3dp"
android:color="@android:color/white"/>
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</layer-list>
</item>
<item android:state_selected="false">
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</selector>
</item>
</ripple>
here is my ripple drawable and i want to change the state_selected, solid color.
code i've tried:
RippleDrawable rippleDrawable = (RippleDrawable) textView.getBackground(); // assumes bg is a RippleDrawable
int[][] states = new int[][]{new int[]{android.R.attr.state_selected}};
int[] colors = new int[]{R.color.white};
ColorStateList colorStateList = new ColorStateList(states, colors);
rippleDrawable.setColor(colorStateList);
unfortuantely it doesn't work.. what am I missing and is this possible?