android - 3 layouts - middle is flexible -
i need following thing:
3 layouts:
- header
- content
- footer
header must on top footer must sticked bottom (android:layout_alignparentbottom="true"
).
but how make middle occupy whole other screen? thanks.
here solution (with android:layout_weight , scrollview):
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#dddddd" android:gravity="center" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="header" tools:ignore="hardcodedtext" /> </linearlayout> <scrollview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="3" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="content" tools:ignore="hardcodedtext" /> </scrollview> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#dddddd" android:gravity="center" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="footer" tools:ignore="hardcodedtext" /> </linearlayout></linearlayout>
and result picture :
Comments
Post a Comment