正文  基础知识 > 程序示例 >

GridView的按下或点击选中后的效果如何去除

<!-- 新建个selector的XML,然后把颜色全改为透明,再在Listselector属性里赋值即可 --> <?xml version="1.0" encodi...

<!-- 新建个selector的XML,然后把颜色全改为透明,再在Listselector属性里赋值即可 -->
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@android:color/transparent" android:state_pressed="true"/>
    <item android:drawable="@android:color/transparent" android:state_selected="true"/>
</selector>
<GridView...
android:listSelector="@drawable/selector_transparent" 
...
>