<!-- orientation:vertical:垂直排列 ; orientation:horizontal;水平排列; --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <!-- match_parent:“填充满”父容器; wrap_content:包裹内容; weight:设置控件与控件的之间的比例 --> <Button android:layout_width="match_parent" android:layout_height="0px" android:layout_weight="1" android:text="button1"/> <Button android:layout_width="match_parent" android:layout_height="0px" android:layout_weight="1" android:text="button2"/> </LinearLayout>
转载请标明出处:Android线性布局
文章来源: Android线性布局