Android: Clicking an empty space in the ListView blackens existing items
My layout contains a ListView (the parent is a LinearLayout)开发者_高级运维. I have defined a certain drawable to be the ListView's background.
When I press an empty space below the last row, all the list rows turn black. I'd like to attach screenshots but for some reason it adding images here doesn't work for me...- Can someone explain how to attach screenshot?
- Any idea why this happens? Couldn't catch any click event in this activity...
Thanks, Rob
Not sure if this is what's causing your problem, but have you read this post? http://developer.android.com/resources/articles/listview-backgrounds.html
I think I once experienced this problem a while ago.
I think it might be something to do with the following two tags in the listview's layout xml file.
android:background="#FFFFFF"
android:cacheColorHint="#FFFFFF"
I rekon they're probably set to different colours in your file? (or missing). Try making them the same colour and see if it still does it. Plus, I rekon that if you had enough rows that the list view overflowed the screen, it would go black like you describe when you scrolled.
This is a bit of a long-shot, but I hope it helps.
精彩评论