android listview ,recycleView item没有点击效果
2017-11-29 14:50
621 查看
1检查item 布局中有没有设置点击事件
2 检查item布局是不是设置了背景色,导致没有默认点击效果了。
我的代码如下:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FF0000" android:orientation="horizontal"> ... </LinearLayout>
检查后发现我的是由于item设置了背景 色导致没有点击效果,如果item设置了背景,在listview添加 listSelector并无任何卵用。
修改可以删除此处背景。或给背景设置selector。或使用下方android 默认的背景:
android:background="?android:attr/selectableItemBackground"
3,recycleView 点击无效果处理方式同上,或如下
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
参考链接
list selectorandroid listview点击没有效果
recycleView 点击无效果处理二种方式
相关文章推荐
- android listview item没有点击效果
- 关于listview的item中如果有textview,listview点击item没有效果的解决办法
- Android中ListView点击和ListView的item里面的Button或ImageView不能同时生效问题的解决
- 利用RecycleView实现类似ListView的Item点击,长按等操作事件以及点击后每一项在添加一个列表
- android中ListView点击和ListView的item里面的button或ImageView不能同时生效的解决
- Android5.x:RecycleView(一):实现ListView + GridView + StaggeredGridLayou效果
- Android ListView怎么取消item的点击效果
- android listview item点击时更改textview的颜色 代码中实现
- android 自定义TextView支持微博功能后在ListView占用了Item点击的解决办法
- android_ListView条目点击没有效果的解决方案
- android listview内的TextView会在点击item的时候灰变背景颜色
- Android RecycleView实现不同样式Item样式效果完美解决
- android ListView的Item中包含Button,CheckBox等可点击view的处理
- recycleview 使用侧滑删除 android 6.0机型出现item抖动;列表一屏以上,点击后面的item(需要滚动查看了) 然后马上会往上滚动回首个item,滚回第一项
- android中listview的item点击切换实现效果(选择器selector)
- Android基础:listview的item点击事件会使里面的Button也出现按压的效果
- Android:ListView设置item点击背景效果
- android listview item取消按点击效果
- android中ListView点击和ListView的item里面的button或ImageView不能同时生效的解决
- Android ListView的item点击没有反应