<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:theme="@android:style/Theme.NoTitleBar">
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="5"
android:background="@color/skyblue">
</RelativeLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@color/silver">
</ScrollView>
</LinearLayout>
layout_weight其实就给在LinearLayout布局中的诸多视图赋予重要度的意思。 也可以理解为各个视图在这个线性布局中所占的比例。
在常用的layout_width和layout_height是指定视图宽高值,其属性值有wrap_content,
fill_parent(match_parent)或者指定大小。但是这样的设置其实各个视图在布局中
所占的大小是均等的或者根据内容的多少自动布局的形式。这时候我们为了在不同屏幕
尺寸的设备上让UI布局不产生太大变化,需要给各个视图指定它们所能占有的空间大小
比例。