1.drawable目录下新建item_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/reveal_color" android:state_pressed="true"/>
<item android:drawable="@color/white"/>
</selector>
2.在item布局中使用
android:background="@drawable/item_seletor"
实现5.0以上水波纹点击效果
新建drawable-v21/item_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/reveal_color">
<item android:drawable="@color/white"/>
</ripple>
网友评论