Android linearLayout 之 layout_weight揭秘

<?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"
              android:layout_gravity="center">
    <TextView android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="风清扬"
              android:gravity="center"
              android:layout_weight="1.0"
              android:background="@color/blue"/>
    <TextView android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="无厓子"
              android:gravity="center"
              android:layout_weight="2.0"/>
    <TextView android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="令狐冲"
              android:gravity="center"
              android:layout_weight="3.0"
              android:background="@color/red"/>
</LinearLayout>

结果如下图:
Android linearLayout 之 layout_weight揭秘

你可能感兴趣的:(android,LinearLayout,layout_weight)