一、.线性布局 LinearLayout
1.1方向控制:android:orientation: vertical,horizontal, 运行时动态改变方向setOrientation(),并传入HORIZONTALAK VERTICAL参数。
1.2填充模型:android:layout_width 和android:layout_height特性。这两个特性的值可能是以下3种形式:
a.具体的大小 px,dip,..
b.wrap_content
c.fill_parent
1.3权重:android:layout_weight分配剩余空间所占的比重。使用权重的另一种方式是采用百分比为单位:
a.将布局中部件的android:layout_width值设置为0.
b.将布局中部件的android:layout_width值设置为想要的百分比。.
c.保证布局中所有部件的android:layout_width值之和为100.
1.4 对齐:layout_gravity
1.5内边距和外边距: android:padding/android:marginTop.

二、相对布局
2.1 相对于容器定位
android:layout_alignParentTop
android:layout_alignParentBottom
android:layout_alignParentLeft
android:layout_alignParentRight
android:layout_centerHorizontal
android:layout_centerVertical
android:layout_centerInParent
所 有这些属性值都是一个boolean,true 或false


2.2 特性中的关联记号
1)以@+id/..的形式为布局添加 这个标识符
2)以不带加号的形式(@id/..)引用其他部件;
2.3 相对与其他部件定位
android:layout_above
android:layout_below
android:layout_toLeftOf
android:toRightOf
android:layout_alignTop
android:layout_alignBottom
android:layout_alignLeft
android:layout_alignRight
android:layout_alingBaseline 所谓基线,就是文本恰好位于其上的一条看不见的线。
2.4 求值次序
Androd1.6 以前单次求值方式处理RelativeLayout定义的布局规则。从Android1.6开始,Android以二次求值方式处理布局规则,这样就可以 放心使用那些尚未定义的部件。
三、表格布局
3.1 在行中添加单元格
每个Table中放入部件,列的数量由Android控制; 程序员只能间接控制列数。
Android:layout_span------相当于HTML单元格的colspan相似。
Android:layout_column=”2”
3.2 Table的其他子元素
在行间放置部件,TableLayout会像沿垂直方向的LinearLayout一样来对齐他们。
在这种情况下,一般可以使用一个简单的View来设置间距。例如,可以使用<View android:layout_height=”2px” android:background=”#0000FF”/> 来设置一个与表格同宽的2像素高的蓝色分隔条。

3.3 扩展、收缩和折叠
Androd:stretchColumns
Android:shrinkColumns
Androidj:collapseColumns
四、滚动
ScrollView

更多相关文章

  1. 控件布局_LinearLayout
  2. 系出名门Android(2) - 布局(Layout)和菜单(Menu)
  3. android 布局实例解析 柱状图效果
  4. Android UI详解之动态布局
  5. Android 常用布局
  6. 时钟控件布局
  7. Android软键盘手动显示、隐藏、布局上移和EditText上移
  8. Andorid在布局文件中中文加粗
  9. Android图文布局【整理】

随机推荐

  1. 反编译工具
  2. Android实现滑动悬浮置顶(二)采用改写Scr
  3. android TextView查看更多(图文混排)
  4. Android获取应用信息判断网络连接返回桌
  5. Android购物分类效果实现
  6. Android之自动提示功能组件AutoComlpeteT
  7. Android 光系统
  8. 【转】android APP使用的jar概况
  9. 你知道android的MessageQueue.IdleHandle
  10. com.google.android.providers.GoogleSet