Disable Ripple on ListView

荒凉一梦 提交于 2019-12-04 02:27:35

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" />

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.

Pierfrancesco Soffritti

Yes, you can create custom list items with their layout, in which you have to change the android:background with a drawable without ripple.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!