1
我有一個列表視圖與可變數量的項目。當需要填充整個屏幕的項目很少時,則我需要在頁腳內部的背景以一直延伸到屏幕底部的圖像視圖。我怎麼能做到這一點?在列表視圖中拉伸一個項目
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/savings_details_activity_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="@+id/default_list_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fadeScrollbars="true"
android:footerDividersEnabled="false"
android:headerDividersEnabled="false"
android:smoothScrollbar="true"
android:listSelector="@color/transparent" />
<ImageView
android:id="@+id/bottom_bar"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/action_bar_background"
android:layout_alignParentBottom="true" />
</RelativeLayout>
列表項
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:paddingLeft="@dimen/margin_10dp"
android:paddingRight="@dimen/margin_10dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/margin_10dp"
android:layout_marginRight="@dimen/margin_10dp"
android:layout_toLeftOf="@+id/list_item_value"
android:layout_toRightOf="@+id/header_image"
android:orientation="vertical">
<TextView
android:id="@+id/list_item_header"
style="@style/LargeTextWhiteWithShadow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="header" />
<TextView
android:id="@+id/list_item_sub_header"
style="@style/SmallTextLightBlueWithShadow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="sub header" />
</LinearLayout>
<TextView
android:id="@+id/list_item_value"
style="@style/LargeTextWhiteWithShadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/margin_5dp"
android:layout_alignParentRight="true"
android:ellipsize="end"
android:singleLine="true"
android:text="value"/>
</RelativeLayout>
我有一個列表視圖頁腳這只是一個形象。我不在乎如果我拉伸列表視圖頁腳或列表中的最後一個項目。
你想你的背景ImageView的,如果你有很多的項目,或exaclty什麼? – Houcine 2012-02-02 18:56:48
換句話說,如果列表和bottom_bar之間存在「空氣」,我想將列表中的頁腳與bottom_bar(imageview)對齊。 – Flexo 2012-02-02 18:57:05
@Houcine bottom_bar正在工作,因爲它應該,我只想在我的列表中使用footer當列表很短時,向下延伸到bottom_bar – Flexo 2012-02-02 18:58:53