开发者

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

开发者 https://www.devze.com 2023-01-14 05:57 出处:网络
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 trackbal开发者_运维知识库l to scroll up and down, and

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 trackbal开发者_运维知识库l 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.


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"
0

精彩评论

暂无评论...
验证码 换一张
取 消