每一个布局均有一个叫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. 辛星跟您玩转vim第三节之程序猿特须要的移动方式

    前面第二节我首先值得一提的是,我的vim教程pdf版本号已经写完了.大家能够去下载,这里是csdn的下载地址:csdn下载.假设左边的下载地址挂掉了.也能够自行在浏览器以下输入例如以下地址进行下载:h ...

  2. Python实现的基于ADB的Android远程工具

    本工具为原创,涉及知识: - Python编程 - Tkinter GUI编程 - ADB通信机制 代码已经开源: https://code.csdn.net/codehat/andev/tree/m ...

  3. mysql 造1亿条记录的单表--大数据表

    读写文件 背景及木:现有数据1000w单表,为压力测试准备1亿条数据. 步骤: 1.将1000w条记录,除id外都导入到多个文件中: //DELIMITER DROP PROCEDURE if EXI ...

  4. Atcoder At Beginner Contest 068 D - Decrease (Contestant ver.)

    D - Decrease (Contestant ver.) Time limit : 2sec / Memory limit : 256MB Score : 600 points Problem S ...

  5. 关于Webpack详述系列文章 (第四篇)

    1. webpack基本概念 Entry:入口,Webpack 执行构建的第一步将从 Entry 开始,可抽象成输入.Module:模块,在 Webpack 里一切皆模块,一个模块对应着一个文件.We ...

  6. Windows下多个Mysql实例配置主从

    序:     网上有很多类似的文章,也是各种百度出来的,但是对于多数刚开始接触MYSQL主从的小白来说,网上文章的代码里面很多技术点都没有理解,有跌打误撞碰上的,但多数都是这篇文章卡主了,换篇文章接着 ...

  7. C8815 用 USB网卡(Asix AX88772 )上网

    C8815 用 USB网卡(Asix AX88772 )上网 C8815不支持给USB外设供电,不过可以使用自供电的OTG线带动USB设备 C8815最新固件中没有Asix AX88772驱动,需要自 ...

  8. curl 使用 ~/.netrc ( Windows 上是 _netrc ) 问题

    curl 使用  --netrc-file <filemame> , -n, --netrc, --netrc-optional 等选项做登录认证时, 默认文件位于 ~/.netrc ( ...

  9. Django环境搭建(一)

    搭建Django环境之前先搭建python运行环境 需要了解: 解释器(编译器): 计算机不能直接理解任何除机器语言外的其他语言,所以程序员必须要把自己写的语言翻译成机器语言,而将其他语言翻译成机器语 ...

  10. python基础--数值类型和序列类型

    Python中数值类型:int(整数),float(浮点数),True/False(布尔值,首字母必须大写) int:1    #任意整数 float:2.3   #小数 python赋值: a = ...