這是我的layout.xml,我想在listview的底部添加一個固定的頁腳。另外,我不能更改當前的佈局。此佈局在頂部包含一個操作欄。第一個相對佈局包含所有佈局,包括動作欄相對佈局,以下我有一個包含listview的框架佈局。我希望這個列表視圖有一個固定在包含一些圖像按鈕的底部的頁腳。如何將頁腳添加到佈局?
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<!-- This acts as Actionbar -->
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:paddingRight="10dp"
android:orientation="horizontal"
android:background="@drawable/action_bar_background_strip" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:clickable="true"
android:onClick="toggleMenu"
android:contentDescription="@null"
android:src="@drawable/drawer_toggle_button" />
<View
android:id="@+id/View1"
android:layout_width="1dp"
android:layout_height="fill_parent"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@+id/imageView1"
android:background="#ffffff" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toRightOf="@+id/View1"
android:layout_marginTop="8dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="115dp"
android:text="Listview"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff"
android:textStyle="bold" />
<View
android:id="@+id/View2"
android:layout_width="1dp"
android:layout_height="fill_parent"
android:layout_toRightOf="@+id/textView1"
android:background="#ffffff" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="@null"
android:src="@drawable/icon" />
</RelativeLayout>
<FrameLayout
android:layout_below="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/listView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:choiceMode="multipleChoice" >
</ListView>
</FrameLayout>
我想你的方式,但線性佈局是透明的, listview從線性佈局按鈕的背景中顯示。 – 2014-10-31 10:04:53
爲listview使用layout_above屬性併爲其賦予頁腳線性佈局的id。這將解決您的問題。 – 2014-12-09 04:44:06