I have an Activity
with a ScrollView
and I want to have a footer below it.
I tried this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
.......
</ScrollView>
<RelativeLayout
android:id="@+id/layout_footer1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<View
android:id="@+id/footer_topline"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#0075b5" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="84dp"
android:layout_height="42dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:maxHeight="30dp"
android:maxWidth="30dp"
android:src="@drawable/logo" />
</RelativeLayout>
</RelativeLayout>
The problem is, that the footer overlaps the ScrollView
.
I tried to use android:layout_above="@id/layout_footer1"
in the ScrollView
and it SEEMS TO WORK in the graphical editor, but when I try to start the app, it gives me an unknown recource error because of layout_footer1
.
You should put the ScrollView
tag below the footer and use android:layout_above="@id/layout_footer1"
for it like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- Footer -->
<RelativeLayout
android:id="@+id/layout_footer1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<View
android:id="@+id/footer_topline"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#0075b5" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="84dp"
android:layout_height="42dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="10dp"
android:maxHeight="30dp"
android:maxWidth="30dp"
android:src="@drawable/logo" />
</RelativeLayout>
<!-- Scroll view -->
<ScrollView
android:id="@+id/scrollView1"
android:layout_above="@id/layout_footer1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ScrollView>
</RelativeLayout>