我想在 ListView
(位于 RelativeLayout
)的顶部有一个分隔线,但是当我尝试使用它时,我只得到底部分隔线:
<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
为什么它也没有标题分隔符?
最佳答案
那不是什么android:headerDividersEnabled应该做的。这意味着如果您要添加列表标题,则该标题是否需要用分隔符分隔。
对于您的问题,只需使用带有分隔线的 ImageView 的线性布局作为源,然后是 ListView。希望这会有所帮助。
关于android:headerDividersEnabled 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13235710/