和我一起看API(一)你所不知道的LinearLayout补充
楼主英语水平差,翻译的不好的话请多多指正,嘿嘿。。。
A Layout that arranges its children in a single column or a single row. The direction of* the row canbe set by
calling {@link #setOrientation(int) setOrientation()}.* You can also specify gravity, which specifies the
alignment of all the child elements by* calling {@link #setGravity(int) setGravity()} or specify that specific
children* grow to fill up any remaining space in the layout by setting the <em>weight</em> member of
{@link android.widget.LinearLayout.LayoutParams LinearLayout.LayoutParams}.* The default orientation is
horizontal.
这是一个将子类排列在一列或一行的布局。通过调用 setOrientation()可以设置行的方向。您还可以指定对其方向,它指定
所有子元素的对齐方式的方法叫做{ @link # setGravity(int)setGravity()}或通过设置权重/weight(< em > < / em >的
成员)指定特定的子类填满剩余的空间布局 { @link android.widget.LinearLayout。LayoutParams LinearLayout.
LayoutParams }。默认的方向是水平的。
/**
* Don't show any dividers.
*不显示任何分割线
*/
public static final int SHOW_DIVIDER_NONE = 0;
/**
* Show a divider at the beginning of the group.
* 显示分割线在这个视图组之前
*/
public static final int SHOW_DIVIDER_BEGINNING = 1;
/**
* 显示分割线在这个布局的每个子视图之间
* Show dividers between each item in the group.
*/
public static final int SHOW_DIVIDER_MIDDLE = 2;
/**
*显示分割线在这个布局的最后
* Show a divider at the end of the group.
*/
public static final int SHOW_DIVIDER_END = 4;
首先画一根线,采用shape.xml绘制:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:shape = "rectangle">
<size
android:width= "@dimen/fab_margin"
android:height= "@dimen/fab_margin" />
<solid android:color= "#ff00ff" />
</shape>
示例代码1设置分割线显示在子类最前方:
<LinearLayout
android:layout_width="fill_parent"
android:gravity="center"
android:divider="@drawable/driver"<!--设置分割线样式-->
android:showDividers="beginning"<!--设置分割线显示方式-->
android:layout_height="fill_parent"
android:orientation="horizontal">
<Button
android:id="@+id/bt1"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="1"/>
<Button
android:id="@+id/bt2"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="2"/>
<Button
android:id="@+id/bt3"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="3"/>
</LinearLayout>
示例2显示分割线在这个布局的每个子视图之间:
<LinearLayout
android:layout_width="fill_parent"
android:gravity="center"
android:divider="@drawable/driver"
android:showDividers="end"
android:layout_height="fill_parent"
android:orientation="horizontal">
<Button
android:id="@+id/bt1"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="1"/>
<Button
android:id="@+id/bt2"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="2"/>
<Button
android:id="@+id/bt3"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="3"/>
</LinearLayout>
示例3*显示分割线在这个布局的最后:
<LinearLayout
android:layout_width="fill_parent"
android:gravity="center"
android:divider="@drawable/driver"<!--设置分割线样式-->
android:showDividers="middle"<!--设置分割线显示方式-->
android:layout_height="fill_parent"
android:orientation="horizontal">
<Button
android:id="@+id/bt1"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="1"/>
<Button
android:id="@+id/bt2"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="2"/>
<Button
android:id="@+id/bt3"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="3"/>
</LinearLayout>
示例4*显示分割线在这个布局的前后中间:
<LinearLayout
android:layout_width="fill_parent"
android:gravity="center"
android:divider="@drawable/driver"<!--设置分割线样式-->
android:showDividers="middle|beginning|end"<!--设置分割线显示方式-->
android:layout_height="fill_parent"
android:orientation="horizontal">
<Button
android:id="@+id/bt1"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="1"/>
<Button
android:id="@+id/bt2"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="2"/>
<Button
android:id="@+id/bt3"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="3"/>
</LinearLayout>
/**
* Set padding displayed on both ends of dividers.
*
* @param padding Padding value in pixels that will be applied to each end
*
* @see #setShowDividers(int)
* @see #setDividerDrawable(Drawable)
* @see #getDividerPadding()
*/
/ * *
*设置内边距显示分隔器的两端。
*
* @param内边距的值将会使用像素作为单位
*
* @see # setShowDividers(int)
* @see # setDividerDrawable(可移动)
* @see # getDividerPadding()
* /
public void setDividerPadding(int padding) {
mDividerPadding = padding;
}
android:dividerPadding="12dp"
3、
/**
* Whether the children of this layout are baseline aligned. Only applicable
* if {@link #mOrientation} is horizontal.
*/
@ViewDebug.ExportedProperty(category = "layout")
private boolean mBaselineAligned = true;
这种布局的子视图是否基线对齐。只适用水平布局--注:基线是在中间
xml代码只需要在LinearLayout布局中添加属性:
android:baselineAligned="true"
*{ @link # mOrientation }
If this layout is part of another layout that is baseline aligned,
* use the child at this index as the baseline.
*
* Note: this is orthogonal to {@link #mBaselineAligned}, which is concerned
* with whether the children of this layout are baseline aligned.
@ViewDebug.ExportedProperty(category = "layout")
*/
@ViewDebug.ExportedProperty(category = "layout")
private int mBaselineAlignedChildIndex = -1;
private int mBaselineAlignedChildIndex = -1;
如果这个布局是另一个基线对齐的布局的一部分,
*使用子视图在这个指数作为基准。
*
*注:这是正交于{ @link # mBaselineAligned },这是担心
*此布局的子视图是否基线对齐。
android:baselineAlignedChildIndex="-1"
/**
* When true, all children with a weight will be considered having
* the minimum size of the largest child. If false, all children are
* measured normally.
*
* @return True to measure children with a weight using the minimum
* size of the largest child, false otherwise.
*
* @attr ref android.R.styleable#LinearLayout_measureWithLargestChild
*/
public boolean isMeasureWithLargestChildEnabled() {
return mUseLargestChild;
}
/ * *
当为真的时候 具有相同权重/比重的所有子类被认为是最大子类的最小权重
如果为假 所有子类测量和平时权重/比重一样
android:measureWithLargestChild="true"
从今晚开始每晚翻译一点,贵在坚持。。。坚持大叔
和我一起看API(一)你所不知道的LinearLayout补充的更多相关文章
- 你所不知道的 CSS 阴影技巧与细节 滚动视差?CSS 不在话下 神奇的选择器 :focus-within 当角色转换为面试官之后 NPOI 教程 - 3.2 打印相关设置 前端XSS相关整理 委托入门案例
你所不知道的 CSS 阴影技巧与细节 关于 CSS 阴影,之前已经有写过一篇,box-shadow 与 filter:drop-shadow 详解及奇技淫巧,介绍了一些关于 box-shadow ...
- 你所不知道的linq(二)
上一篇说了from in select的本质,具体参见你所不知道的linq.本篇说下from...in... from... in... select 首先上一段代码,猜猜结果是什么? class P ...
- 你所不知道的库存超限做法 服务器一般达到多少qps比较好[转] JAVA格物致知基础篇:你所不知道的返回码 深入了解EntityFramework Core 2.1延迟加载(Lazy Loading) EntityFramework 6.x和EntityFramework Core关系映射中导航属性必须是public? 藏在正则表达式里的陷阱 两道面试题,带你解析Java类加载机制
你所不知道的库存超限做法 在互联网企业中,限购的做法,多种多样,有的别出心裁,有的因循守旧,但是种种做法皆想达到的目的,无外乎几种,商品卖的完,系统抗的住,库存不超限.虽然短短数语,却有着说不完,道不 ...
- 你所不知道的setInterval
在你所不知道的setTimeout记载了下setTimeout相关,此篇则整理了下setInterval:作为拥有广泛应用场景(定时器,轮播图,动画效果,自动滚动等等),而又充满各种不确定性的这set ...
- 你所不知道的setTimeout
JavaScript提供定时执行代码的功能,叫做定时器(timer),主要由setTimeout()和setInterval()这两个函数来完成.它们向任务队列添加定时任务.初始接触它的人都觉得好简单 ...
- 你真的会玩SQL吗?你所不知道的 数据聚合
你真的会玩SQL吗?系列目录 你真的会玩SQL吗?之逻辑查询处理阶段 你真的会玩SQL吗?和平大使 内连接.外连接 你真的会玩SQL吗?三范式.数据完整性 你真的会玩SQL吗?查询指定节点及其所有父节 ...
- 你所不知道的SQL Server数据库启动过程,以及启动不起来的各种问题的分析及解决技巧
目前SQL Server数据库作为微软一款优秀的RDBMS,其本身启动的时候是很少出问题的,我们在平时用的时候,很少关注起启动过程,或者很少了解其底层运行过程,大部分的过程只关注其内部的表.存储过程. ...
- 你所不知道的SQL Server数据库启动过程(用户数据库加载过程的疑难杂症)
前言 本篇主要是上一篇文章的补充篇,上一篇我们介绍了SQL Server服务启动过程所遇到的一些问题和解决方法,可点击查看,我们此篇主要介绍的是SQL Server启动过程中关于用户数据库加载的流程, ...
- Android中Context详解 ---- 你所不知道的Context
转自:http://blog.csdn.net/qinjuning/article/details/7310620Android中Context详解 ---- 你所不知道的Context 大家好, ...
随机推荐
- dotNET跨平台相关文档整理
一直在从事C#开发的相关技术工作,从C# 1.0一路用到现在的C# 6.0, 通常情况下被局限于Windows平台,Mono项目把我们C#程序带到了Windows之外的平台,在工作之余花了很多时间在M ...
- 最好的.NET开源免费ZIP库DotNetZip(.NET组件介绍之三)
在项目开发中,除了对数据的展示更多的就是对文件的相关操作,例如文件的创建和删除,以及文件的压缩和解压.文件压缩的好处有很多,主要就是在文件传输的方面,文件压缩的好处就不需要赘述,因为无论是开发者,还是 ...
- input标签中button在iPhone中圆角的问题
1.问题 使用H5编写微信页面时,使用<input type="button"/>时,在Android手机中显示正常,但是在iPhone手机中则显示不正常,显示为圆角样 ...
- C#日志
参考页面: http://www.yuanjiaocheng.net/Entity/first.html http://www.yuanjiaocheng.net/Entity/jieshao.htm ...
- QQ空间动态爬虫
作者:虚静 链接:https://zhuanlan.zhihu.com/p/24656161 来源:知乎 著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 先说明几件事: 题目的意 ...
- Function.prototype.toString 的使用技巧
Function.prototype.toString这个原型方法可以帮助你获得函数的源代码, 比如: function hello ( msg ){ console.log("hello& ...
- 安卓GreenDao框架一些进阶用法整理
大致分为以下几个方面: 一些查询指令整理 使用SQL语句进行特殊查询 检测表字段是否存在 数据库升级 数据库表字段赋初始值 一.查询指令整理 1.链式执行的指令 return mDaoSession. ...
- 手机游戏渠道SDK接入工具项目分享(二)万事开头难
一般接到任务后程序员们通常都开始着手进行技术调研了,但我这活是项目负责人.还有一大堆事情要先期准备,没人能帮忙. 一.人力配置 考虑的之前已经有一波人搞了大半年,但没有起色,先期也没有太大人力需求,所 ...
- 【一起学OpenFoam】02 软件准备
"工欲善其事必先利其器",在利用OpenFoam解决我们的工程问题之前,首先要做的事情是搭建一个OpenFoam运行环境.很遗憾的是,OpenFoam的原生开发系统是Linux,因 ...
- 第11章 Linux服务管理
1. 服务分类 (1)Linux的服务 ①Linux中绝大多数的服务都是独立的,直接运行于内存中.当用户访问时,该服务直接响应用户,其好处是服务访问响应速度快.但不利之处是系统中服务越多,消耗的资源越 ...