开发者

Disable Android ListView selector

I am开发者_StackOverflow中文版 trying to disable the ListView selector on my ListView. I set the List Selector color to a transparent color. This seems to do the trick, but when I select certain text, they change colors. How can I make things work ok?


In your XML where you declare the ListView use:

<ListView android:id="@+id/my_list" android:listSelector="#00000000" />


Are you looking for ListView 's setClickable(false) and setEnabled(false) method ?


It's not the best solution, but for me it worked:

You can set the text color manually (in xml or at runtime)


You can change the color of selected items to match your background. This question was asked here.


Apply below code to your list view.

android:listSelector="@android:color/transparent"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜