首页 > 移动平台 > 详细

Android:控件布局(线性布局)

时间:2014-06-12 15:26:26      阅读:370      评论:0      收藏:0      [点我收藏+]

android:orientation指定LinearLayout布局方向,值:vertical (垂直方向) 、horizontal(水平方向)

实例一:

bubuko.com,布布扣

bubuko.com,布布扣
<?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" >

<Button 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="按钮1"
    />

<Button 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="按钮2"
    />
<Button 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="按钮3"
    />
<Button 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="按钮4"
    />
</LinearLayout>
bubuko.com,布布扣

 

实例二:

bubuko.com,布布扣

bubuko.com,布布扣
<?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="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"
    />
<Button 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="按钮4"
    />
</LinearLayout>
bubuko.com,布布扣

Android:控件布局(线性布局),布布扣,bubuko.com

Android:控件布局(线性布局)

原文:http://www.cnblogs.com/tinyphp/p/3781665.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!