Android布局控件之常用linearlayout布局

2019-12-10 19:17:26于丽

1.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://www.easck.com/apk/res/android"
android:orientation="horizontal"
android:baselineAligned="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮1"
/> 
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮2"
/> 
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮3"
/> 
</LinearLayout>

2.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://www.easck.com/apk/res/android"
android:orientation="vertical"
android:baselineAligned="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮1"
/> 
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮2"
/> 
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮3"
/> 
</LinearLayout>

3.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://www.easck.com/apk/res/android"
android:orientation="vertical"
android:baselineAligned="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮1"
/> 
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮2"
/> 
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮3"
/> 
</LinearLayout>