Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ListView: Doesn't highlight on touch, but works when I use the trackball

I am using a couple of ListView elements in my app. In all cases, it doesn't highlight the selected item when I click/touch it, but I can use the trackball to scroll up and down, and can see the orange highlighted color then. How do I fix this?

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

like image 571
Vijay Kotari Avatar asked Sep 04 '10 19:09

Vijay Kotari


1 Answers

Setting the background to the list_selector_background for the parent Layout element for each of the items did the trick.

android:background="@android:drawable/list_selector_background"
like image 86
Vijay Kotari Avatar answered Oct 05 '22 20:10

Vijay Kotari