每一个布局均有一个叫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) 收藏的更多相关文章

  1. hadoop调优之一:概述 分类: A1_HADOOP B3_LINUX 2015-03-13 20:51 395人阅读 评论(0) 收藏

    hadoop集群性能低下的常见原因 (一)硬件环境 1.CPU/内存不足,或未充分利用 2.网络原因 3.磁盘原因 (二)map任务原因 1.输入文件中小文件过多,导致多次启动和停止JVM进程.可以设 ...

  2. 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 ...

  3. Binary Tree 分类: POJ 2015-06-12 20:34 17人阅读 评论(0) 收藏

    Binary Tree Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6355   Accepted: 2922 Descr ...

  4. 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 ...

  5. HTTP 错误 500.19- Internal Server Error 错误解决方法 分类: Windows服务器配置 2015-01-08 20:16 131人阅读 评论(0) 收藏

    1.第一种情况如下: 解决方法如下: 经过检查发现是由于先安装Framework组件,后安装iis的缘故,只需重新注册下Framework就可以了,具体步骤如下 1 打开运行,输入cmd进入到命令提示 ...

  6. winform Execl数据 导入到数据库(SQL) 分类: WinForm C# 2014-05-09 20:52 191人阅读 评论(0) 收藏

    首先,看一下我的窗体设计: 要插入的Excel表: 编码 名称 联系人 电话 省市 备注 100 100线 张三 12345678910 北京 测试 101 101线 张三 12345678910 上 ...

  7. Ubuntu 命令行下快速打开各类文件 分类: ubuntu shell 2014-11-18 20:06 210人阅读 评论(0) 收藏

    xdg-open 命令可以用来在Ubuntu下快速打开各类文件. 下面是从 manual 文档里截取的内容: 可以知道,该命令的功能是在图形界面下按照用户的平时习惯打开各类文件,甚至是链接. 这样,我 ...

  8. 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 ...

  9. 解决ORA-29857:表空间中存在域索引和/或次级对象 & ORA-01940:无法删除当前连接的用户问题 分类: oracle sde 2015-07-30 20:13 8人阅读 评论(0) 收藏

    今天ArcGIS的SDE发生了一点小故障,导致系统表丢失,所以需要重建一下SDE数据库,在删除SDE用户和所在的表空间过程中遇到下面两个ORA错误,解决方法如下: 1)删除表空间时报错:ORA-298 ...

随机推荐

  1. 车牌识别--S5PV210測试第二次优化

    优化: 1.RGB转HSV 浮点运算改成定点运算: 2.匹配模板由图片改成C语言数组: 3.优化測试BMP车牌图片读取(两层for循环改为一层for循环). 总体相比优化之前时间降低110ms左右. ...

  2. 50行python代码实现个代理server(你懂的)

    之前遇到一个场景是这种: 我在自己的电脑上须要用mongodb图形client,可是mongodb的server地址没有对外网开放,仅仅能通过先登录主机A,然后再从A连接mongodbserverB. ...

  3. 19,tuple多元数组

    #include <iostream> #include <tuple> using namespace std; void main() { char ch = 'a'; ; ...

  4. Android连接socket服务器上传下载多个文件

    android连接socket服务器上传下载多个文件1.socket服务端SocketServer.java public class SocketServer { ;// 端口号,必须与客户端一致 ...

  5. POJ 1113 Wall 求凸包

    http://poj.org/problem?id=1113 不多说...凸包网上解法很多,这个是用graham的极角排序,也就是算导上的那个解法 其实其他方法随便乱搞都行...我只是测一下模板... ...

  6. AJAX - 封装AJAX GET 数组join( )方法 键值对取value POST请求参数注意点

    function objToStr(obj){ obj.t = new Date().getTime(); // 给obj动态增加了一个属性 // 这个给对象添加属性的方法, 会被直接加到键值对里?? ...

  7. django遇到的那些古怪问题

    AssertionError: .accepted_renderer not set on Response 出错原因,没有在合法的方法内使用 response 响应,之前在dispatch内直接re ...

  8. 自绘listCtrl控件选中该行高亮(模拟windows)

    CListCtrl的派生类CMyListCtrl的DrawItem()函数里添加代码 CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC); if ...

  9. eclipse4.3怎么集成jadclipse追踪源代码,现在windows-preferences-java

      A.将net.sf.jadclipse_3.2.4.jar复制到D:\leaf\eclipse\plugins目录下.  B.在d:\leaf下建立ecliplsePlungin\jadclips ...

  10. JS学习笔记 - fgm练习 2-12- 全选反选 判断CheckBox是否选中 &&运算符

    练习地址:http://www.fgm.cc/learn/lesson2/12.html 总结: 1.  && 运算符,从左向右依次执行,如果遇到 false,就不再继续执行后面的语句 ...