Disable Android ListView selector
Asked Answered
S

5

5

I am 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?

Silassilastic answered 15/6, 2011 at 23:39 Comment(0)
B
0

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

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

Barnard answered 15/6, 2011 at 23:47 Comment(0)
C
33

In your XML where you declare the ListView use:

<ListView android:id="@+id/my_list" android:listSelector="#00000000" />
Carmelinacarmelita answered 16/6, 2011 at 1:45 Comment(3)
This should be marked as the answer since it shows clearly WHAT needs to be set in order to modify the list selector.Resist
yes agreed, this appears to be a bug in android i was using @null which does not work, this does.Swoon
Perhaps android:listSelector="@android:color/transparent" would me more readableSpermogonium
T
1

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

Tuner answered 15/6, 2011 at 23:45 Comment(0)
B
0

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

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

Barnard answered 15/6, 2011 at 23:47 Comment(0)
E
0

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

Eulau answered 16/6, 2011 at 1:17 Comment(0)
P
0

Apply below code to your list view.

android:listSelector="@android:color/transparent"
Portland answered 10/5, 2016 at 5:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.