In Android 5.0, my ListView produces a ripple effect when clicking a list item. Is there a way to disable this effect? Looking at the docs, I don't see any way (https://developer.android.com/reference/android/widget/ListView.html)
Asked
Active
Viewed 1.7k times
3 Answers
44
You can remove or replace the list selector using the android:listSelector
property. The default list selector under Material is ?android:attr/selectableItemBackground
which is a bounded ripple.
<ListView
...
android:listSelector="@drawable/my_list_selector" />
To completely disable selector, you can use a @null
or @android:color/transparent
(works better for some Android versions) value as following:
<ListView
...
android:listSelector="@android:color/transparent" />

alanv
- 23,966
- 4
- 93
- 80
-
1this removed the ripple but instead gave me a yellow background instead. I used this instead: `android:listSelector="@android:color/transparent"` – sudoExclaimationExclaimation Sep 16 '16 at 18:31
18
Try:
<ListView
...
android:listSelector="@android:color/transparent" />
This will disable any visual effect of touching. Not very good for the user, but might be useful in special circumstances.

Oliv
- 10,221
- 3
- 55
- 76
0
Yes, you can create custom list items with their layout, in which you have to change the android:background
with a drawable without ripple.

tomrozb
- 25,773
- 31
- 101
- 122

Pierfrancesco Soffritti
- 1,678
- 1
- 18
- 22
-
1That only covers the ripple... which works most of the time, unless you need a semi-transparent background for your list items – oli.G Feb 17 '16 at 12:06