4

I have a simple listview that has some listitems. Currently, to make the items ripple on touch, I just added android:drawSelectorOnTop="true" to the listview.

This works perfectly.

However, some of the list items are headers and should not show ripples because they do not have an action associated with them. How can I disable the ripple effect for only the headers?

The listview contains linearlayouts for the rows and the headers.

I tried the following on the header with no success:

  • setting clickable to false
  • setting listSelector to null.
  • setting focusable to false.

Can anyone point me in the right direction?

Josue Espinosa
  • 5,009
  • 16
  • 47
  • 81

1 Answers1

4

Possibly a duplicate question. But as a summary: try disabling those elements in your adapter. You can use the .areAllItemsEnabled() and .isEnabled() callbacks for this purpose.

Community
  • 1
  • 1
Zsombor Erdődy-Nagy
  • 16,864
  • 16
  • 76
  • 101