Android_layout_note
LinearLayout线程布局
LinearLayout属性
android:orientation表示线性布局的方向
vertical: 垂直。从上往下
horizontal: 水平。从左往右
android:weightSum 权重总和
控件通用属性
android:background背景色。值为RGB颜色值。格式为#RGB #RRGGBB
android:layout_width、android:layout_height: 布局的宽度和高度
wrap_content: 内容包括。内容有多少,长度就仅有多少
match_parent: 填充父窗口。父窗口有多少。长度就有多少
xxxdp:自定义的长度。(单位为dp)
0dp: 高度、宽度由另外的属性(android:layout_weight)来设置,这里忽略
android:layout_weight 该控件占父控件的权重比。当设置该值后,对应的宽/高需要设置成0dp
layout_marginXxx控件有效区域与控件边界之间的距离
paddingXxx 控件内容与控件有效区域之间的距离
gravity 控件内容的对齐方式
layout_gravity 控件本身的对齐方式
----------------------------------------
RelativeLayout相对布局
一个控件相对于另外一个控件的位置
需要给每个控件添加唯一的ID独立区分每个控件
在另一个控件的上/下/左/右方(值为另一个控件的id)
android:layout_above
android:layout_below
android:layout_toLeftOf
android:layout_toRightOf
与另一个控件对齐(值为另一个控件的id)
android:layout_alignLeft
android:layout_alignRight
android:layout_alignTop
android:layout_alignBottom
与父控件的边界对齐(值为true/false)
android:layout_alignParentTop
android:layout_alignParentBottom
android:layout_alignParentLeft
android:layout_alignParentRight
位于父控件的中央(值为true/false)
android:layout_centerVertical 垂直居中
android:layout_centerHorizontal 水平居中
android:layout_centerInParent 正中央
-------------------------------------------
FrameLayout帧布局
使用于图片的叠置(少见)
先写的图片放到底部
后写的图片放到顶部
-------------------------------------------
GridLayout网格布局 (4.0提出)
gridlayout属性
android:rowCount 多少行
android:columnCount 多少列
gridlayout中的控件,
如果跨多行,设置android:layout_rowSpan="2" android:layout_gravity="fill"
如果跨多列,设置android:layout_columnSpan="2" android:layout_gravity="fill"
-------------------------------------------
过时的布局
TableLayout 表格布局
AbsoluteLayout 绝对布局
-
Android_layout_note的更多相关文章
随机推荐
- poj1160Post Office(DP)
http://poj.org/problem?id=1160 算水过的吧 四重循环没优化 CZ说爆可过 就爆了 dp[i][j] = min(dp[i][j],dp[i-1][g]-s) 第i个点建在 ...
- bzoj1056
花了一上午大概复习了一下splay,treap 像这种裸的数据结构题在js应该会越来越少 不过练练手也好, 这就是平衡树+hash,如果这是单纯的BST应用,还是写treap吧,好调试 ; ...
- Master Nginx(4) - Nginx as a Reverse Proxy
Introduction to reverse proxying the proxy module legacy servers with cookies the upstream module ke ...
- T型架构观点学习
一.成为T型人才 眼界格局思维要尽可能的开阔,并不断横向开阔,专业能力要尽可能专注,并且纵向上不断加深: 互联网的快速迭代开发和扁平化管理,使单纯管理人才的作用越来越小,除了分配任务和项目管理,在其他 ...
- HTTP2.0那些事
1. HTTP2.0的前世 http2.0的前世是http1.0和http1.1这两兄弟.虽然之前仅仅只有两个版本,但这两个版本所包含的协议规范之庞大,足以让任何一个有经验的工程师为之头疼.http1 ...
- codeforces 652C Foe Pairs 水题
题意:给你若干个数对,给你一个序列,保证数对中的数都在序列中 对于这个序列,询问有多少个区间,不包含这些数对 分析:然后把这些数对转化成区间,然后对于这些区间排序,然后扫一遍,记录最靠右的左端点就好 ...
- HDU-5373 The shortest problem
The shortest problem http://acm.hdu.edu.cn/showproblem.php?pid=5373 Time Limit: 3000/1500 MS (Java/O ...
- HDU-5347 MZL's chemistry
http://acm.hdu.edu.cn/showproblem.php?pid=5347 MZL's chemistry Time Limit: 2000/1000 MS (Java/Others ...
- Kafka系列(二)特性和常用命令
Kafka中Replicas复制备份机制 kafka将每个partition数据复制到多个server上,任何一个partition有一个leader和多个follower(可以没有),备份的个数可以 ...
- hdoj 5522 Numbers
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5522 水题:暴力过 #include<stdio.h> #include<strin ...