Android LinearLayout属性
来源:互联网 发布:windows显示后缀名 编辑:程序博客网 时间:2024/06/04 19:39
LinearLayout 线性布局:既然是线性的,就有方向的问题。所以就得定义是分水平还是垂直
android:orientation="vertical" 定义为水平方向
android:orientation="horizontal" 定义为垂直方向
当然,你要是不定义的话,默认是垂直的。但是这种习惯不好。。。
还有什么常用的属性呢,,,
android:layou_weight="值" 分配权重 。使用这个属性时,该控件不需要去定义高度(即:android:layout_height="wrap_content")。这个值表示该控件对没有占用的空间的大小。
就比如:
<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" tools:context="${relativePackage}.${activityClass}" > <TextView android:layout_width="match_parent" android:layout_weight="1" android:text="@string/hello_world" /> <Button android:layout_width="wrap_content" android:layout_weight="1" android:text="@string/hello_world"/></LinearLayout>
你能很清楚的看到整个手机屏幕被TextView和Button各自占一半的空间。如果你把Button的layout_weight改成2,那就意味着整个LinearLayout的布局要分成3份,其中这个Button要占用2份的空间大小。总之,你要想把一块空间分割成几个小块,那你就可以使用这个属性了。
暂时就先这样吧。。。。。
0 0
- Android LinearLayout 重要属性
- Android LinearLayout 常用属性
- LinearLayout属性android:orientation
- LinearLayout android:divider属性
- Android LinearLayout属性
- Android LinearLayout属性解析
- android LinearLayout android:baselineAligned属性
- Android 之LinearLayout的属性
- android(LinearLayout)属性详解
- android linearlayout 的gravity属性
- Android布局-LinearLayout属性详解
- Android 笔记 linearlayout 属性 layout_weight
- Linearlayout的android:divider属性
- Android LinearLayout线性布局属性
- 对android LinearLayout中layout_weight属性使用
- Android中LinearLayout与RelativeLayout属性解说
- android入门-LinearLayout和RelativeLayout 属性对比
- Android 布局 LinearLayout 的 layout_weight 属性
- Access denied for user 'root'@'localhost' (using password: NO)
- Design Pattern: Singleton
- A:LinkedList实现了List接口; B: AbstractSet实现了Set接口; C: HashSet继承自AbstractSet基类; D: WeakMap继承自 AbstractMap
- final 不能修饰抽象类 方法可以被重载 但不能被重写
- 探究c++对象模型之data语义学(一)
- Android LinearLayout属性
- 多重边框 不用嵌套的多重边框写法
- Leetcode 332. Reconstruct Itinerary
- 51Nod-1464-半回文
- MySQL启动不了,无法启动MySQL服务
- JDK工具(1) jps
- Hard 380题 Insert Delete GetRandom O(1)
- Ubuntu下显卡管理
- javascript判断浏览器和终端类型,js如何区分手机、电脑终端和浏览器