Non-switchable List Separator

I would like to disable the click of a Listview element. One solution is to override areAllItemsEnabled(), to always return false, and isEnabled()to return false for a specific position. However, this leads to the disappearance of the dividing lines around a specific list item. Several people have suggested returning true for areAllItemsEnabled()and false for isEnabled(), but this does not work for me. I hesitate to place the dividing line manually, because I will need to add the parent layout to the XML element.

Is there a way to prevent the Listview element from being clickable and save

+3
source share
3 answers

, . false areAllItemsEnabled() isEnabled(). , .

areAllItemsEnabled() == false, .

+2

View, , : view.setClickable(false). , view.setFocusable(false).

0

, . , . , , view.setOnClickListener(null).

Boom may be a workaround, not a real solution, but it works. I should notice that I added separators programmatically in the footer ListView, so I had a link to the separators, and I could just set OnClickListenerto null.

0
source

All Articles