码迷,mamicode.com
首页 > 移动开发 > 详细

Android学习笔记二-Linear Layout

时间:2014-07-22 22:46:54      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:android   blog   http   使用   strong   width   

1、LinearLayout是子view均为单方向的,即均为水平或垂直方向的布局。你可以用android:orientation属性来

定义layout方向

bubuko.com,布布扣

所有子view都是一个挨着一个的,所以一个垂直列表,不管它本身多宽,同时只能有一行。若是水平列表,则都等高。

 

 

2、LayoutWeight

用来操控各个子view的相对比例,,即各个子元素对空间的使用权重

Weight并非网上很多文章所叙述的那样(文章都过于片面),weight是指某个组件在布局中【剩余空间】中的显示权重,那么所谓的剩余空间又是什么意思呢,其实是在没有设置weight属性的控件优先显示的情况,将未占用的布局空间合理分配给设置过weight的组件

       <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:background="#12ed34"
        android:hint="@string/DealTool" />
       <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="3"
        android:background="#67bb88"
        android:hint="@string/DealTool" />
       <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:background="#00aa00"
        android:hint="@string/hello_world" />

 测试之后上图。

 

 

REF:http://blog.csdn.net/frank_softworks/article/details/7320268

Android学习笔记二-Linear Layout,布布扣,bubuko.com

Android学习笔记二-Linear Layout

标签:android   blog   http   使用   strong   width   

原文地址:http://www.cnblogs.com/gaozy/p/3859715.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!