取消GridView/ListView item被点击时的效果
2016-03-16 23:57
260 查看
转载地址 :http://www.android100.org/html/201305/24/2734.html
方法一,在控件被初始化的时候设置
方法二,在布局文件中设置listSelector属性
当然也可以定制化自己想要的效果。
推荐使用方法二,解耦逻辑代码与布局文件。
方法一,在控件被初始化的时候设置
gridView.setSelector(new ColorDrawable(Color.TRANSPARENT)); listView.setSelector(new ColorDrawable(Color.TRANSPARENT));
方法二,在布局文件中设置listSelector属性
<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"/>
当然也可以定制化自己想要的效果。
推荐使用方法二,解耦逻辑代码与布局文件。
相关文章推荐
- Session and cookie
- 合并两个排序的链表
- Android异步消息处理机制(二):源码分析
- win8 vc++编译的程序在XP系统运行报错。一个警告标志(黄色三角形里面一个感叹号)
- Golang glfw中使用opengl库的问题
- 离散数学(1)-偏序的反链分解方法
- HTTP 405 错误 – 方法不被允许 (Method not allowed)【转载】
- Runtime运行时机制
- POJ 2492 A Bug's Life 并查集
- 判断单链表是否存在环及寻找环的入口点
- BillBoardView自定义控件广告板轮播
- 【LeetCode题意分析&解答】38. Count and Say
- 矩形覆盖
- SQL Server实现类似于自动刷新数据的功能
- JDBC知识 - 马士兵视频教程笔记
- (R)?ex - A simple framework to simplify system administration and datacenter automation
- 【C】由printf("%d\t%d\t%d\n",a,a+=(a++),a);引起的思考
- xdotool源代码,需要的伙伴请自取
- 变态跳台阶
- 51NOD1515 明辨是非