去掉gridview點擊背景有黃色選中效果

有時候我們點擊gridview時,item有選中效果,背景是黃色,去掉這一效果需要:

1、在drable新建xml文件,並在gridview裏面用lisetselector引用

android:listSelector="@drawable/grid_selector"

2、定義內容

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >


    <selector xmlns:android="http://schemas.android.com/apk/res/android" >
        <item
            android:drawable="@drawable/back_white"
            android:state_pressed="true"/>
        <item
            android:drawable="@drawable/back_white"
            android:state_window_focused="false"/>
        <item
            android:drawable="@drawable/back_white"
            android:state_window_focused="true"/>
    </selector>


</animation-list>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章