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>

 

posted @ 2016-04-28 09:49  wen_dao_  阅读(120)  评论(0编辑  收藏  举报