我正在用listview和一些其他视图创建一个布局。我想完整的布局滚动列表,所以我将其他视图添加为标题。问题是我的列表视图有一些边界,它也适用于标题。ListView标头 - 不同的边距
我应该怎么改变,使头部看起来像这 -
的ListView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_color">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:scrollbars="none"
android:id="@+id/lvProfileAddresses"
android:layout_gravity="center_horizontal"
android:divider="@color/transparent"
android:dividerHeight="10dp"
android:paddingBottom="10dp"
android:clipToPadding="false"
android:cacheColorHint="@color/background_color"
android:fadingEdgeLength="3dp"
/>
</LinearLayout>
头
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent"
>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:text="My Addresses"
android:textSize="20sp"
android:padding="10dp"
android:textColor="@color/black"
/>
<Button android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add New Address"
android:drawableRight="@drawable/small_list_arrow"
android:layout_margin="5dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="@drawable/linearlayout_shadow"/>
</LinearLayout>
如何使ListView的标题具有不同的边距?
你如何添加标题中的ListView? – 2014-10-10 08:29:11
@MysticMagic膨胀的观点,并使用'listview.addHeaderView()' – 2014-10-10 09:30:23