关于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 ...
随机推荐
- 使WordPress改域名后网站正常运行的方法
使WordPress改域名后网站正常运行的方法 wp-content/wp-config.php $path = '/blog'; $scheme = (isset($_SERVER['HTTPS'] ...
- Fragment-按返回键程序退出
今天在做fragment的时候,发现一个问题,当我的界面停留在fragment的时候,按物理返回键,这时候会推出整个应用.这当然不是我们期望的,我们期望按返回键以后,应用界面返回添加fragment之 ...
- VS Code 好用的扩展程序
1. Atom One Dark Theme.看得比较舒服的主题. 2. Beautify.格式化代码必备. 3. Bracket Pair Colorizer.不同层次的括号颜色不同,光标在括号间时 ...
- RFID的工作流程
工作流程 1.阅读器通过发射天线发送一定频率的射频信号, 2.当射频卡进入发射天线工作区域时产生感应电流,射频卡获得能量被激活: 3.射频卡将自身编码等信息通过卡内置发送天线发送出去 4.系统接收天线 ...
- drawable-图片绘制
首先看一下,下端代码 private Bitmap createSelectedChip(RecipientEntry contact, TextPaint paint) { int height = ...
- 解决浏览器不兼容websocket
本例使用tomcat 7.0的websocket做为例子. 1.新建web project.2.找到tomcat 7.0 lib 下的 catalina.jar,tomcat-coyote.jar添加 ...
- Nginx配置GZIP
记录一次解决网站加载慢的问题 一. nginx配置 gzip on;gzip_min_length 1k;gzip_buffers 4 16k;gzip_http_version 1.1;g ...
- 字符串中的空格替换问题(Java版)
解决方式一:时间复杂度为O(n^2) 解决方式二:时间复杂度为O(n) 代码实现: package string; public class SpaceStringReplace2 { //len为数 ...
- echarts3.0 仪表盘实例更改完成占用率实例
需要完成的项目效果 官方实例效果 基本思路: 首先引入jquery和echarts3.0库. 需要两个仪表盘,一个仪表盘是纯色灰色,在底部.startAngle 和endAngle永远是最大值,默认为 ...
- Day1:用户交互与格式化输出
一.用户交互 1.input()方法 #!/usr/bin/env python # -*- coding:utf-8 -*- # Author:Hiuhung Wan username = inpu ...