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?
Disable Android ListView selector
Asked Answered
It's not the best solution, but for me it worked:
You can set the text color manually (in xml or at runtime)
In your XML where you declare the ListView use:
<ListView android:id="@+id/my_list" android:listSelector="#00000000" />
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 readable –
Spermogonium
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"
© 2022 - 2024 — McMap. All rights reserved.