是否可以为ListView设置边距/填充而不将边距应用于标题?我希望我的ListView与Google Now布局一样.除了这个小问题,我已经完成了所有工作.
问题:是否可以不将ListView的布局参数应用于其标题?
EDIT1:更多信息
紫色视图是listView的标题.我已经尝试在列表项布局中添加边距.这也不起作用.我需要的是一种方法,将边距应用于列表视图,以便它不会将边距应用于listView中的标头.
EDIT2:我的布局header.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="@dimen/top_height"
android:background="@color/top_item" />
<View
android:id="@+id/placeholder"
android:layout_width="match_parent"
android:layout_height="@dimen/sticky_height"
android:layout_gravity="bottom" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
root_list.xml
<LinearLayout>
<com.abhijith.CustomListView
android:id="@android:id/list"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_height="wrap_content" /></LinearLayout>
Run Code Online (Sandbox Code Playgroud)
list_item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/card_background"
android:orientation="vertical" >
<TextView
android:id="@+id/textview_note"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textview_note_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"/></LinearLayout>
Run Code Online (Sandbox Code Playgroud)
由于这篇文章的篇幅,我已经删除了uselsess布局属性.
