2012-02-02 3 views
1

У меня есть listview с переменным количеством элементов. Когда для заполнения всего экрана требуется несколько элементов, я хочу, чтобы фон внутри нижнего колонтитула растянулся до изображения в нижней части экрана. Как я могу это достичь?растягивая один элемент в listview

<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> 

У меня есть ListView колонтитула, который просто изображение. Меня не волнует, если я растягиваю нижний колонтитул списка или последний элемент в списке.

+0

вы хотите вы ImageView в фоновом режиме, если у вас есть много пунктов, или exaclty что? – Houcine

+0

Другим словом я хочу выровнять нижний колонтитул в моем списке с помощью bottom_bar (изображение), если есть «воздух» между списком и bottom_bar – Flexo

+0

@Houcine bottom_bar работает так, как должен, я просто хочу, чтобы нижний колонтитул в моем списке растянуть до нижней_бары, когда список короткий – Flexo

ответ

Смежные вопросы