Row not highlighting on long press in ListView
I have the android:cacheColorHint="#00000000" set on my ListView, which fixed this issue in one of my other lists in another activity, b开发者_StackOverflow中文版ut it's not helping in this other list. I'm using the Light theme in my app, if that matters. I can't figure out what's going on. Long press brings up the context menu just fine, I just don't get the nice highlight of the row while pressing it.
Any ideas?
If you have manually set the backgroundColor of your list view item View, it will not work. (Unless you make your background a State enabled Drawable).
The reason it works by default is that the background is a state drawable that listens for the pressed, selected, etc... states. By setting the background to a solid colour, you get rid of that functionality.
精彩评论