为什么listview的item变黑了
16lz
2021-01-26
今天开发时碰到一个问题,我的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"
当然,原文作者也承认,这样的作法给开发者带来了不便.
我还以为是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"
当然,原文作者也承认,这样的作法给开发者带来了不便.
更多相关文章
- ionic4项目结合chrome在Android真机运行调试
- 为开发者准备的最佳 Android(安卓)函数库(2016年版)
- Android开发者指南(2) —— aapt
- android开发大牛博客
- 原著阅读 - Android(安卓)Programming The Big Nerd Ranch Guide
- [置顶] Android开发者社区
- Android(安卓)Studio 奇技淫巧
- Android(安卓)M 新的运行时权限开发者需要知道的一切 (安卓6.0新
- Android(安卓)定时重复启动弹出窗口。