关于LayoutParams 分类: H1_ANDROID 2013-10-27 20:34 776人阅读 评论(0) 收藏
每一个布局均有一个叫LayoutParams的内部类,如:
LinearLayout.LayoutParams
RelativeLayout.LayoutParams
AbsoluteLayout.LayoutParams
TableLayout.LayoutParams
TableLayout.LayoutParams
FrameLayout.LayoutParams
此内部类用于指明某个view在其父元素中的位置,以linearLayout为例:
Per-child
layout information associated with LinearLayout.
Standard
gravity constant that a child supplies to its parent. Defines how the child view should be positioned, on both the X and Y axes, within its enclosing layout.
在LinearLayout中,只有2个xml属性:layout_gravity, layout_weight
但在RelativeLayout中,由于其涉及较多的位置选项,因此有多个xml属性:
| Attribute Name | Related Method | Description |
| android:layout_above | Positions the bottom edge of this view above the given anchor view ID. | |
| android:layout_alignBaseline | Positions the baseline of this view on the baseline of the given anchor view ID. | |
| android:layout_alignBottom | Makes the bottom edge of this view match the bottom edge of the given anchor view ID. | |
| android:layout_alignEnd | Makes the end edge of this view match the end edge of the given anchor view ID. | |
| android:layout_alignLeft | Makes the left edge of this view match the left edge of the given anchor view ID. | |
| android:layout_alignParentBottom | If true, makes the bottom edge of this view match the bottom edge of the parent. | |
| android:layout_alignParentEnd | If true, makes the end edge of this view match the end edge of the parent. | |
| android:layout_alignParentLeft | If true, makes the left edge of this view match the left edge of the parent. | |
| android:layout_alignParentRight | If true, makes the right edge of this view match the right edge of the parent. | |
| android:layout_alignParentStart | If true, makes the start edge of this view match the start edge of the parent. | |
| android:layout_alignParentTop | If true, makes the top edge of this view match the top edge of the parent. | |
| android:layout_alignRight | Makes the right edge of this view match the right edge of the given anchor view ID. | |
| android:layout_alignStart | Makes the start edge of this view match the start edge of the given anchor view ID. | |
| android:layout_alignTop | Makes the top edge of this view match the top edge of the given anchor view ID. | |
| android:layout_alignWithParentIfMissing | If set to true, the parent will be used as the anchor when the anchor cannot be be found for layout_toLeftOf, layout_toRightOf, etc. | |
| android:layout_below | Positions the top edge of this view below the given anchor view ID. | |
| android:layout_centerHorizontal | If true, centers this child horizontally within its parent. | |
| android:layout_centerInParent | If true, centers this child horizontally and vertically within its parent. | |
| android:layout_centerVertical | If true, centers this child vertically within its parent. | |
| android:layout_toEndOf | Positions the start edge of this view to the end of the given anchor view ID. | |
| android:layout_toLeftOf | Positions the right edge of this view to the left of the given anchor view ID. | |
| android:layout_toRightOf | Positions the left edge of this view to the right of the given anchor view ID. | |
| android:layout_toStartOf | Positions the end edge of this view to the start of the given anchor view ID. |
总而言之,LayoutParams子类用于指定某个元素的位置信息。
版权声明:本文为博主原创文章,未经博主允许不得转载。
关于LayoutParams 分类: H1_ANDROID 2013-10-27 20:34 776人阅读 评论(0) 收藏的更多相关文章
- hadoop调优之一:概述 分类: A1_HADOOP B3_LINUX 2015-03-13 20:51 395人阅读 评论(0) 收藏
hadoop集群性能低下的常见原因 (一)硬件环境 1.CPU/内存不足,或未充分利用 2.网络原因 3.磁盘原因 (二)map任务原因 1.输入文件中小文件过多,导致多次启动和停止JVM进程.可以设 ...
- NYOJ 119 士兵杀敌(三)【ST算法】 分类: Brush Mode 2014-11-13 20:56 101人阅读 评论(0) 收藏
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=119 解题思路: RMQ算法. 不会的可以去看看我总结的RMQ算法. http://blo ...
- Binary Tree 分类: POJ 2015-06-12 20:34 17人阅读 评论(0) 收藏
Binary Tree Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6355 Accepted: 2922 Descr ...
- bzoj 1041 圆上的整点 分类: Brush Mode 2014-11-11 20:15 80人阅读 评论(0) 收藏
这里先只考虑x,y都大于0的情况 如果x^2+y^2=r^2,则(r-x)(r+x)=y*y 令d=gcd(r-x,r+x),r-x=d*u^2,r+x=d*v^2,显然有gcd(u,v)=1且u&l ...
- HTTP 错误 500.19- Internal Server Error 错误解决方法 分类: Windows服务器配置 2015-01-08 20:16 131人阅读 评论(0) 收藏
1.第一种情况如下: 解决方法如下: 经过检查发现是由于先安装Framework组件,后安装iis的缘故,只需重新注册下Framework就可以了,具体步骤如下 1 打开运行,输入cmd进入到命令提示 ...
- winform Execl数据 导入到数据库(SQL) 分类: WinForm C# 2014-05-09 20:52 191人阅读 评论(0) 收藏
首先,看一下我的窗体设计: 要插入的Excel表: 编码 名称 联系人 电话 省市 备注 100 100线 张三 12345678910 北京 测试 101 101线 张三 12345678910 上 ...
- Ubuntu 命令行下快速打开各类文件 分类: ubuntu shell 2014-11-18 20:06 210人阅读 评论(0) 收藏
xdg-open 命令可以用来在Ubuntu下快速打开各类文件. 下面是从 manual 文档里截取的内容: 可以知道,该命令的功能是在图形界面下按照用户的平时习惯打开各类文件,甚至是链接. 这样,我 ...
- House Robber 分类: leetcode 算法 2015-07-09 20:53 2人阅读 评论(0) 收藏
DP 对于第i个状态(房子),有两种选择:偷(rob).不偷(not rob) 递推公式为: f(i)=max⎧⎩⎨⎪⎪{f(i−1)+vali,f(i−2)+vali,robi−1==0robi−1 ...
- 解决ORA-29857:表空间中存在域索引和/或次级对象 & ORA-01940:无法删除当前连接的用户问题 分类: oracle sde 2015-07-30 20:13 8人阅读 评论(0) 收藏
今天ArcGIS的SDE发生了一点小故障,导致系统表丢失,所以需要重建一下SDE数据库,在删除SDE用户和所在的表空间过程中遇到下面两个ORA错误,解决方法如下: 1)删除表空间时报错:ORA-298 ...
随机推荐
- TimePickerDialog -下划线颜色修改
首先就是去framework下去找与之相关的theme属性 最开始的时候,直接找的是<item name="datePickerStyle">@style/Widget ...
- 推广一下新Blog www.hrwhisper.me
新博客地址:www.hrwhisper.me 欢迎互访加友链~
- springMVC注解用法:@modelattribute的用法
在Spring MVC里,@ModelAttribute通常使用在Controller方法的参数注解中,用于解释model entity,但同时,也可以放在方法注解里. 如果把@ModelAttrib ...
- amaze样例页面分析(一)
amaze样例页面分析(一) 一.总结 1.从审查(inspect)中是很清楚的可以弄清楚这些part之间的结构关系的 2.一者在于弄清楚他们之间的结构关系,二者在于知道结构的每一部分是干嘛的 3.i ...
- 需求:在浏览器加载完毕后,自动播放视频:出现play() failed because the user didn't interact with the document first.错误
解决方法:给video标签加入<video muted></video> 静音即可. Chrome 66为了避免标签产生随机噪音. 参考链接:https://juejin.im ...
- SD卡与tf卡引脚转换
https://www.cnblogs.com/shangdawei/p/3255414.html
- Java Web学习总结(16)——JSP的九个内置对象
一.JSP运行原理 每个JSP 页面在第一次被访问时,WEB容器都会把请求交给JSP引擎(即一个Java程序)去处理.JSP引擎先将JSP翻译成一个_jspServlet(实质上也是一个servlet ...
- 2017.1-TOP5 Android开源库
Colorful (Github) Colorful简单实用,通过这个开源库可以通过编码的方式来改变应用的主题,不再需要定义不同的style dependencies { compile 'com.g ...
- Codeforces Round #426 (Div. 1) A.The Meaningless Game (二分+数学)
题目链接: http://codeforces.com/problemset/problem/833/A 题意: 给你 \(a\) 和 \(b\),两个人初始化为 \(1\).两个人其中一方乘以 \( ...
- JS错误记录 - getStyle代替offset、任意值运动框
本次练习错误总结: 1. 改变border的宽度,属性名称不是直接写border,而是borderWidth. 2. 运动函数 -- 清除定时器 -- 开启新的定时器. 不是在新定时器开启之后再清除 ...