今天开发时碰到一个问题,我的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"
当然,原文作者也承认,这样的作法给开发者带来了不便.
本文介绍了在Android开发中ListView背景变黑的原因及解决方法。该现象为系统默认优化所致,用于提示用户列表可滚动。通过设置listview的xml属性android:cacheColorHint=#00000000即可解决。
1244

被折叠的 条评论
为什么被折叠?



