I'm stuck with a problem: I have an xml drawable that I wanna use as background for a radiobutton, but the ripple effect isn't working. Can anyone help me with that?
My xml for the background:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#8bc34a" >
<item>
<selector>
<item android:drawable="@drawable/tb_checked" android:state_checked="true"></item>
<item android:drawable="@drawable/transparent"></item>
</selector>
</item>
</ripple>
If you want to show an unbounded ripple above or below additional content, use a <layer-list>
container to stack them and don't put any content inside the <ripple>
element.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<ripple android:color="#8bc34a" />
</item>
<item>
<selector>
<item android:drawable="@drawable/tb_checked"
android:state_checked="true" />
<item android:drawable="@drawable/transparent" />
</selector>
</item>
</layer-list>