I have the following layout influenced by accepted answer here
list.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
android:orientation="vertical" >
....
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
layout="@layout/footer" />
<ListView
android:id="@+id/song_list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/footer"
android:layout_gravity="center_horizontal"
android:layoutAnimation="@anim/list_animation"
android:listSelector="@drawable/bg_list_row_song" />
</RelativeLayout>
</LinearLayout>
and footer.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/img_ad"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/adv" />
</LinearLayout>
which produce this image
My problem is that I want the footer at the end of layout and fill_width and then maitain height to make the image fill real mobile screen width. I can do this by setting a certain list-height but don't want that to support longer screens.
Is there any way to calculate footer width first and maintain its height when its at bottom of layout, then assign remaining height to list? and how?
EDIT
Thanks for your answers, I've figured out best way to do this, I scaled my image to be wider than device screen, and I used
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:adjustViewBounds="true"
android:src="@drawable/adv" />
<ListView
android:id="@+id/song_list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/footer"
android:layoutAnimation="@anim/list_animation"
android:listSelector="@drawable/bg_list_row_song" />
</RelativeLayout>