Disable ripple in ListView

In Android 5.0, my ListView creates a ripple effect when I click on a list item. Is there any way to turn off this effect? Looking at the docs, I see no way ( https://developer.android.com/reference/android/widget/ListView.html )

+6
source share
3 answers

You can remove or replace the list selector with the android:listSelector . The default list selector in the Material section is ?android:attr/selectableItemBackground , which is limited ripple.

 <ListView ... android:listSelector="@drawable/my_list_selector" /> 

To completely disable the selector, you can use the value @null or @android:color/transparent (better for some versions of Android) as follows:

 <ListView ... android:listSelector="@android:color/transparent" /> 
+24
source

Try:

 <ListView ... android:listSelector="@android:color/transparent" /> 

This will turn off any visual touch effect. Not very good for the user, but may be useful in special circumstances.

+17
source

Yes, you can create custom list items with their layout in which you must change android:background with the ability to draw without ripples.

0
source

Source: https://habr.com/ru/post/978876/


All Articles