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 )
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.
是的,您可以使用它们的布局创建自定义列表项,您必须在其中更改android:background
并使用drawable而不会出现波纹。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.