GridView/ListView item被点击后的效果

来源:互联网 发布:美国5g网络什么时候出 编辑:程序博客网 时间:2024/05/03 02:40

方法一,在控件被初始化的时候设置

?
1
2
gridView.setSelector(newColorDrawable(Color.TRANSPARENT));
listView.setSelector(newColorDrawable(Color.TRANSPARENT));

方法二,在布局文件中设置listSelector属性


?
1
2
3
4
5
6
7
8
9
10
11
12
13
<GridView
        android:listSelector="@android:color/transparent"
        android:numColumns="auto_fit"
        android:columnWidth="50dp"
        android:stretchMode="spacingWidth"
        android:layout_weight="1.0"
        android:layout_height="0dip"
        android:layout_width="match_parent"/>
 
<ListView
        android:listSelector="@android:color/transparent"
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>
当然也可以定制化自己想要的效果。 

0 0
原创粉丝点击