Android中Listview点击item不变颜色及设置listselector 无效的解决方案
作者:rencm 时间:2022-07-04 23:49:10
这是同一个问题,Listview中点击item是会变颜色的,因为listview设置了默认的listselector,有一个默认的颜色,同理如果点击没颜色变化我们怎么设置listselector也不会变颜色的。
但是在我们的开发过程中,我们可能会碰到这样的问题listview点击不变颜色,总结了一下大概有这几种原因:
1、item的layout设置background颜色值,去掉背景颜色即可
2、listview中listselector属性的效果被覆盖了,比如列表的Item为一个占满单元格的ImageView的时候,ImageView如果有内容那么listSelector的效果就会被挡住
这个时候我们需要在ListView添加drawSelectorOnTop属性并设置为true
android:drawSelectorOnTop="true"
以上所述是小编给大家介绍的Android中Listview点击item不变颜色及设置listselector 无效的解决方案网站的支持!
来源:http://www.cnblogs.com/rencm/archive/2016/09/29/5919485.html
标签:listview,listselector,item
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Spring boot中filter类不能注入@Autowired变量问题
2023-04-24 14:17:41
![](https://img.aspxhome.com/file/2023/5/64375_0s.jpg)
C#实现Datatable排序的方法
2022-12-30 11:31:52
java实现文件拷贝的七种方式
2023-07-20 19:01:41
JAVA中AES加密方法实例分析
2023-12-18 13:09:40
深入理解Java设计模式之命令模式
2023-11-24 11:06:31
![](https://img.aspxhome.com/file/2023/4/59684_0s.jpg)
深入了解c# 迭代器和列举器
2022-04-24 16:32:37
小米Java程序员第二轮面试10个问题 你是否会被刷掉?
2023-11-13 09:00:29
![](https://img.aspxhome.com/file/2023/6/59026_0s.jpg)
Android 启动页白屏解决方案
2023-11-06 02:54:02
C#控制台输出进度和百分比的实例代码
2021-10-01 23:49:43
C#时间格式转换为时间戳的方法步骤
2022-04-13 12:27:19
java selenium教程环境搭建基于Maven
2023-11-27 01:35:38
Java 调整格式日志输出
2021-10-05 23:09:14
![](https://img.aspxhome.com/file/2023/7/77957_0s.png)
C#预定义的基础类型转换
2023-08-13 03:14:16
![](https://img.aspxhome.com/file/2023/8/69788_0s.png)
java获取包下被指定注解的类过程解析
2023-08-08 11:12:27
基于Class.forName()用法及说明
2021-06-20 19:09:30
![](https://img.aspxhome.com/file/2023/7/61877_0s.png)
C#实现计算器功能(winform版)
2021-07-16 06:40:15
![](https://img.aspxhome.com/file/2023/7/96317_0s.jpg)
解析C#编程的通用结构和程序书写格式规范
2022-12-22 03:41:41
springboot之Jpa通用接口及公共方法使用示例
2023-02-17 16:18:52
![](https://img.aspxhome.com/file/2023/2/86772_0s.png)
Java Mybatis框架多表操作与注解开发详解分析
2023-12-04 17:15:14
![](https://img.aspxhome.com/file/2023/6/88746_0s.png)
List集合多个复杂字段判断去重的案例
2022-08-01 16:23:28