Android:layout_weight详解
中文定义:
在一个布局组件中(例如:LinearLayout)中各个子元素的对于剩余空间的使用权重。
默认:android:layout_weight= 0
默认情况下,布局模式以android:height 和 android:weight为标准
案例:
现在设置2个LinearLayout 个占据一张,第一行有左右各一个按钮,中间设置一个文本显示框
第二行设置一个按钮,主要是为了使第一行的文本显示框自动扩张大小,布局文件如下:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientat |