我是android新手,我正在使用線性佈局。我想放置佔用屏幕20%的圖像。這裏是代碼,但這不起作用。LinearLayout的layout_weight for android不起作用
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/sky" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/schoolroad" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="8" >
</RelativeLayout>
</LinearLayout>
結果是左側佈局佔用了屏幕的80%。
我的代碼有什麼問題?