[android-developers] Re: LinearLayout not filling all screen
Simon wrote:
> I'm trying to create a simple view of a header image, few buttons,
> then footer image. I'm using a LinearLayout inside a ScrollView.
>
> Even though i'm using the android:layout_gravity="bottom" for the
> footer image, it's being placed about 1 cm above the bottom margin.
>
> i'm using the following xml config
>
> <?xml version="1.0" encoding="utf-8"?>
> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:scrollbars="none"
> android:background="#FFFF">
>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
> android:orientation="vertical"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:background="#FFFF" >
>
> <ImageView
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:background="#FFFF"
> android:src="@drawable/faa_header"
> android:layout_gravity="top"/>
>
> <Button android:id="@+id/button_tutorial"
> android:text="@string/button_tutorial"
> android:layout_height="wrap_content"
> android:layout_width="fill_parent"/>
>
> <Button android:id="@+id/buttons_emergency_now"
> android:text="@string/buttons_emergency_now"
> android:layout_height="wrap_content"
> android:layout_width="fill_parent"/>
>
> <Button android:id="@+id/button_emergency_hints"
> android:text="@string/button_emergency_hints"
> android:layout_height="wrap_content"
> android:layout_weight="1"
> android:layout_width="fill_parent"/>
> <ImageView
> android:layout_gravity="bottom"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:background="#FFFF"
> android:src="@drawable/footer"/>
> </LinearLayout>
> </ScrollView>
Try changing the LinearLayout from android:layout_height="fill_parent"
(which I think may be meaningless when wrapped in a ScrollView) to
android:layout_height="wrap_content".
Or, switch from LinearLayout to RelativeLayout and anchor the ImageView
to the bottom via android:layout_alignParentBottom="true".
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android App Developer Training: http://commonsware.com/training.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home