Android ~ layout_weight example

code
------------------------------------------------------------------------------------------
<?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">
<Button android:text="@+id/Button01" android:id="@+id/Button01"
android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="fill_parent">
</Button>
<TextView android:text="zzzzzzzzzzzzz"
android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:layout_weight="2">
</TextView>
</LinearLayout>
------------------------------------------------------------------------------------------
result
Photobucket


code
------------------------------------------------------------------------------------------
<?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">
<Button android:text="@+id/Button01" android:id="@+id/Button01"
android:layout_height="wrap_content" android:layout_weight="2" android:layout_width="fill_parent">
</Button>
<TextView android:text="zzzzzzzzzzzzz"
android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:layout_weight="1">
</TextView>
</LinearLayout>
------------------------------------------------------------------------------------------
result
Photobucket

reference
http://www.eoeandroid.com/viewthread.php?tid=3278

沒有留言: