Search code examples
javaandroidandroid-listviewbaseadapterdivider

Android: remove divider of some listitems in listview


I've created a listview with a BaseAdapter. I want some of the listitems to have a divider, but from some of the listitems, I want to remove the divider. I know you can remove the divider of the whole list by setting .setDivider(null) and .setDividerHeight(0), but is it also possible to remove the divider from a single listitem inside a list?

Thanks in advance!


Solution

  • You could disable the divider for the whole list and set a custom View for each ListItem, e.g. setting different background drawables with or without a bottom border.