禁用 Listview 上的涟漪效应
Disable ripple effect on Listview
我有一个简单的列表视图,其中包含一些列表项。目前,为了使项目在触摸时出现波纹,我刚刚将 android:drawSelectorOnTop="true"
添加到列表视图。
这非常有效。
但是,某些列表项是 header,不应显示涟漪,因为它们没有关联的操作。如何禁用 仅 和 header 的涟漪效应?
列表视图包含行和 headers 的线性布局。
我在 header 上尝试了以下操作但没有成功:
- 将
clickable
设置为 false
- 将
listSelector
设置为空。
- 将
focusable
设置为 false。
谁能给我指出正确的方向?
可能 a duplicate question. But as a summary: try disabling those elements in your adapter. You can use the .areAllItemsEnabled() and .isEnabled() 回调用于此目的。
我有一个简单的列表视图,其中包含一些列表项。目前,为了使项目在触摸时出现波纹,我刚刚将 android:drawSelectorOnTop="true"
添加到列表视图。
这非常有效。
但是,某些列表项是 header,不应显示涟漪,因为它们没有关联的操作。如何禁用 仅 和 header 的涟漪效应?
列表视图包含行和 headers 的线性布局。
我在 header 上尝试了以下操作但没有成功:
- 将
clickable
设置为 false - 将
listSelector
设置为空。 - 将
focusable
设置为 false。
谁能给我指出正确的方向?
可能 a duplicate question. But as a summary: try disabling those elements in your adapter. You can use the .areAllItemsEnabled() and .isEnabled() 回调用于此目的。