Android: headerDividersEnabled not working

I want to have a separator at the top of the ListView (which fits in a RelativeLayout ), but when I try to use this, I get only the bottom separator:

 <ListView android:id="@+id/last_contacts_picked_list" android:headerDividersEnabled="true" android:footerDividersEnabled="true" android:paddingTop="50dp" android:dividerHeight="5dp" android:layout_marginTop="50dp" android:divider="@android:drawable/divider_horizontal_textfield" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="..." android:layout_alignLeft="..." android:layout_alignRight="..." android:layout_below="..." /> 

I have something like this:

http://i051.radikal.ru/1211/4f/a408db5e717f.png

Why doesn't it have a header separator?

+4
source share
1 answer

This is not what android: headerDividersEnabled should . This means that if you add a list heading, should this heading be separated by a separator or not.

For your problem, just use a linearlayout with a delimited ImageView as the source, followed by a ListView. Hope this helps.

+11
source

Source: https://habr.com/ru/post/1444149/


All Articles