2012-11-05 157 views
4

我想有在ListView顶部的分隔(这是摆在RelativeLayout),但是当我尝试使用此,我只得到了底部除法:安卓:headerDividersEnabled不工作

<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="..." 
     /> 

我有这样的事情:

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

为什么它不具备标头分隔吗?

+0

发布添加标头的代码 – njzk2

回答

11

这不是android:headerDividersEnabled应该做的。这意味着如果要添加列表标题,是否需要用分隔符分隔该标题。

对于您的问题,只需在ImageView中使用带有分隔符作为源代码后跟ListView的线性布局。希望这可以帮助。

+1

以下是一个工作示例:http://stackoverflow.com/a/8819402/915756 –