Android ListView: not highlighted by touch, but works when I use trackball

I am using a couple of ListView elements in my application. In all cases, it does not highlight the selected item when I click on it, but I can use the trackball to scroll up and down and then see the orange highlighted color. How to fix it?

For example, one of them is a LinearLayout with two TextViews in it.

+7
android listview
source share
1 answer

Setting the background to list_selector_background for the parent layout element for each of the elements did the trick.

android:background="@android:drawable/list_selector_background" 
+11
source share

All Articles