I have been trying desperately to fix this issue where my ListView items are highlighted. I have reviewed any solution I could find here on stackoverflow, and have found none that work for me.
First off, this is a ListView in a LinearLayout in a ViewPager in a LinearLayout.
Each Item in that Listview is a LinearLayout containing a LinearLayout (Containing a TextView) and a Gallery. The Gallery contains multiple LinearLayouts containing a TextView and Imageview in a FrameLayout.
This problem occurs, not on click but on drag, as when swiping your finger over a story (sometimes while the ListView scrolls with your drag) the item underneath becomes selected. Additionally, this particular problem only occurs on devices where the over-scroll effect does not cause a bounce when scrolling.
Attempts to solve the issue are as follows:
android:cacheColorHint
to #00000000
(does nothing?)I just can't figure out why it's doing this and I really need it to stop.
This was a most interesting problem. The solution of which is even more interesting.
For some reason, what I didn't try, and what nobody thought of, was to remove android:background
from the LinearLayout
for the ListView items.
Upon removing android:background
, the layout continues to display properly and the black no longer appears.
If you have a problem similar to this that this does not solve, you may want to check the Android Blog: Why is my list black?
EDIT: This worked fine for ICS, but elicited a much larger problem in 2.1. To completely solve the ordeal, I ended up having to specify android:cacheColorHint="#000000"
to the ListView
(and the LinearLayout
for good measure) in my inline styles as well as in the style definition I applied to the ListView
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With