shape和selector的结合

shape和selector的结合

去掉gridview本身的点击效果:android:listSelector="@color/de_transparent";

添加两个selector,灰色的press和normal样式,还有蓝色的press和normal样式;

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false" >
<solid android:color="@color/colorPrimaryDark" />
<size android:width="20dp"
android:height="20dp"/>
</shape>
</item> <item>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false" >
<solid android:color="@color/colorAccent" />
<size android:width="20dp"
android:height="20dp"/>
</shape>
</item>
</selector>
上一篇:Android 二维码 生成和识别(附Demo源码)


下一篇:以太坊solidity编程常见错误(不定期更新)