New UI-布局之LinearLayout(线性布局)详解
——转载请注明出处:coder-pig,欢迎转载,请勿用于商业用途!
真正的详解,基本用法,weight权重属性完全解析,divider设置分割线,layout_gravity的注意事项..
Android中的布局分为六大布局,分别是:
LinearLayout(线性布局),RelativeLayout(相对布局),TableLayout(表格布局)
FrameLayout(帧布局),AbsoluteLayout(绝对布局),GridLayout...
分类:
其他好文 时间:
2015-01-03 16:01:40
阅读次数:
271
一、先送上效果图:
二、xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:...
分类:
移动开发 时间:
2014-12-31 18:27:44
阅读次数:
190
1.view.getTranslationX计算的是该view的偏移量。初始值为0,向左偏移值为负,向右偏移值为正。
2.view.getX相当于该view距离父容器左边缘的距离,等于getLeft+getTranslationX。
示意图:
举例:
布局文件:
<RelativeLayout xmlns:android="http://schemas.andro...
分类:
移动开发 时间:
2014-12-31 14:39:13
阅读次数:
250
android:layout_above="@id/xxx" --将控件置于给定ID控件之上android:layout_below="@id/xxx" --将控件置于给定ID控件之下android:layout_toLeftOf="@id/xxx" --将控件的右边缘和给定ID控件的左边缘对齐an...
分类:
移动开发 时间:
2014-12-31 10:01:23
阅读次数:
398
RelativeLayout布局android:layout_marginTop="25dip" //顶部距离android:gravity="left" //空间布局位置android:layout_marginLeft="15dip //距离左边距// 相对于给定ID控件android:layo...
分类:
移动开发 时间:
2014-12-30 15:04:12
阅读次数:
110
常用布局FrameLayout:子元素没有相对位置概念,都相对于左上角LinearLayout:线性布局,一个接一个,水平或垂直RelativeLayout:相对布局,可相对其它子元素TableLayout:水平和垂直LinearLayout的混和如:<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/a..
分类:
移动开发 时间:
2014-12-28 01:53:34
阅读次数:
270
组件布局最好通过一个兄弟组件或者父组件确定其位置坐标。gravity属性,能容在组件内部的位置EditText中的提示属性hint,以及如何设置密码的输入格式 1 7 8 14 15 23 24 33 34 41 42 49...
分类:
移动开发 时间:
2014-12-27 17:20:49
阅读次数:
195
layout_below,layout_above,layout_toRightOf,layout_toLeftOflayout_alignRight,layout_alignLeft,layout_alignTop,layout_alignBotton什么是baseLine?
分类:
移动开发 时间:
2014-12-27 16:08:45
阅读次数:
180
与父空间的位置关系layout_alignParentBotton,layout_alignParentTop,layout_alignParentRight,layout_alignParentLeftlayout_centerInParent,layout_centerHorizontal,la...
分类:
移动开发 时间:
2014-12-27 16:00:33
阅读次数:
200
2、创建自定义布局类
public class TopBar extends RelativeLayout {
//自定义控件...
分类:
移动开发 时间:
2014-12-27 11:27:14
阅读次数:
256