今天开发时碰到一个问题,我的listview有背景图片,但当点击listview下方的空白区域时,listview中的item背景变成了黑色.
我还以为是android的一个bug,但上google上搜了一下,在下面的文章中找到了答案.
http://android-developers.blogspot.com/2009/01/why-is-my-list-black-android.html
This technique is used throughout the system to indicate that the container can be scrolled.
This rendering issue is caused by an optimization of the Android framework enabled by default on all instances of ListView.
不过文中也提出了解决方法,设置一下listview的xml属性就可以解决了.
android:cacheColorHint="#00000000"
当然,原文作者也承认,这样的作法给开发者带来了不便.
分享到:
相关推荐
经常需要在项目中实现以下效果,点击listview中子item的颜色会改变
listview 拖动 item 排序,参照了DragSortListView:可拖动排序的listview DragSortListView:可拖动排序的listview
android ListView Item点击展开子项效果
Android ListView每个Item上面的有TextView和Button,为ListView每个Item上面的按钮添加事件,并获取TextView文本信息。
Android Listview Item上下拖动位置
关于listview item重用导致图片重复加载 图片重新请求
listview在滚动时背景变黑 listview在滚动时背景变黑
ListView Item 排序 长按选中 移动排序
android listview item 选择
动态添加、移除ListView的itemView!非常流畅哦
listview item选中删除,全选,取消
listview item点赞和收藏,listview item中控件的点击事件,未涉及到网络请求,网络请求请自己在点击事件中添加,代码虽然简单但是思路很重要哦 listview item点击事件
ListView Item多布局的实现
listview item
listview多种item
自定义listview,实现item特效,通过左右滑动删除listview item效果
仿微信的ListView item可左右滑动效果
ListView列表Item样式,亲测,可正常运行
ListView item 通过拖拽来实现 item 的交换,类似 QQ 分组管理
点击ListView的item弹出Dialog,点击Dialog的某个控件,更改item的值。