xml中的波纹可绘制不起作用

use*_*164 4 xml android android-layout android-5.0-lollipop

我遇到了一个问题:我有一个xml drawable,我想用作radiobutton的背景,但是涟漪效应不起作用.任何人都可以帮助我吗?

我的xml为背景:

<?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>
Run Code Online (Sandbox Code Playgroud)

ala*_*anv 7

如果要在其他内容之上或之下显示无界波纹,请使用<layer-list>容器来堆叠它们,并且不要在<ripple>元素中放置任何内容.

<?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>
Run Code Online (Sandbox Code Playgroud)