Search code examples
androidlistviewheaderpreferenceactivitydivider

Android ListView divider near group header


I have PreferenceActivity with several PreferenceGroup. The ListView doesn't show a divider above and under the header of PreferenceGroup. How does it know whether to show that header or not?

Let's say I have a ListView with custom adapter. How can I tell it which entries are the headers and shouldn't have dividers around it?

Thanks


Solution

  • Those are not headers, they are separators. The adapter tells the ListView which item is a separator by returning false at isEnabled.

    http://developer.android.com/reference/android/widget/BaseAdapter.html

    public boolean isEnabled (int position)

    Returns true if the item at the specified position is not a separator. (A separator is a non-selectable, non-clickable item).