Android Xml Layout, How To Fill Content To The Entire Screen, Keeping The Footer Intact?
I have 3 main elements in my XML layout (also see the image): The header, a linearLayout (nothing exciting here) The content, a relativeLayout, there is an image in there that I c
Solution 1:
Use RelativeLayout layout like this
<?xml version="1.0" encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/main_layotu"android:layout_width="fill_parent"android:layout_height="fill_parent" ><LinearLayoutandroid:id="@+id/header"android:layout_width="fill_parent"android:layout_height="100dp"android:layout_alignParentTop="true" ></LinearLayout><LinearLayoutandroid:id="@+id/footer"android:layout_width="fill_parent"android:layout_height="100dp"android:layout_alignParentBottom="true" ></LinearLayout><RelativeLayoutandroid:layout_width="fill_parent"android:layout_height="fill_parent"android:layout_above="@id/footer"android:layout_below="@id/header"android:layout_centerInParent="true" ></RelativeLayout></RelativeLayout>
Solution 2:
Try like this..
<?xml version="1.0" encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/relativeLayout1"android:layout_width="fill_parent"android:layout_height="fill_parent" ><LinearLayoutandroid:id="@+id/linearLayout1"android:layout_width="wrap_content"android:layout_height="100dp"android:layout_alignParentLeft="true"android:layout_alignParentRight="true"android:layout_alignParentTop="true"android:orientation="vertical" ></LinearLayout><RelativeLayoutandroid:id="@+id/relativeLayout2"android:layout_width="wrap_content"android:layout_height="200dp"android:layout_alignParentLeft="true"android:layout_alignParentRight="true"android:layout_below="@+id/linearLayout1" ></RelativeLayout><LinearLayoutandroid:id="@+id/linearLayout2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentLeft="true"android:layout_alignParentRight="true"android:layout_below="@+id/relativeLayout2"android:layout_alignParentBottom="true"android:orientation="vertical" ></LinearLayout></RelativeLayout>
make a relative layout as the parent layout of all the 3 other layouts and put
android:layout_below="@+id/relativeLayout2"
android:layout_alignParentBottom="true"
in the last linear layout
Post a Comment for "Android Xml Layout, How To Fill Content To The Entire Screen, Keeping The Footer Intact?"