Android入门第二篇之LinearLayout、AbsoluteLayout
来源:互联网 发布:华为网络盒子每月 编辑:程序博客网 时间:2024/06/01 07:11
本文来自http://blog.csdn.net/hellogv/
Android 的UI 布局都以Layout 作为容器,在上面按照规定排列控件,这方面跟JAVA 的Swing 和LWUIT 很像。控件跟Layout 有很多属性是一样的,可以在Properties 里面修改,跟.NET/Delphi 等RAD 类似,其中最常用的属性有以下这些:
id="@+id/edtInput",ID 是连接UI 与代码的桥梁
Gravity= "center" ,Layout 中的控件居中
layout_width="fill_parent" ,自动填充至屏幕宽度,layout_height 同理
layout_width="wrap_content" ,自动填充为控件大小,layout_height 同理
LinearLayout ,在入门第一篇所用的Layout 就是LinearLayout ,它的理解很简单:在LinearLayout 里面的控件,按照水平或者垂直排列:
orientation="horizontal" :水平排列;orientation=" vertical" :垂直排列
当LinearLayout 是horizontal ,并且里面的控件使用了layout_width="fill_parent" ,第二组控件会挡在屏幕的右边,那也就是看不到了。。。
AbsoluteLayout ,是一个按照绝对坐标定义的布局,由于使用绝对坐标去定位控件,因此要实现自适应界面时,应尽少使用 AbsoluteLayout 。 AbsoluteLayout 里面的控件都以layout_x 、layout_y 来定义其位置:
上图中的TextView01的X坐标为10px,Y坐标为10px:
Android 的UI 布局都以Layout 作为容器,在上面按照规定排列控件,这方面跟JAVA 的Swing 和LWUIT 很像。控件跟Layout 有很多属性是一样的,可以在Properties 里面修改,跟.NET/Delphi 等RAD 类似,其中最常用的属性有以下这些:
id="@+id/edtInput",ID 是连接UI 与代码的桥梁
Gravity= "center" ,Layout 中的控件居中
layout_width="fill_parent" ,自动填充至屏幕宽度,layout_height 同理
layout_width="wrap_content" ,自动填充为控件大小,layout_height 同理
LinearLayout ,在入门第一篇所用的Layout 就是LinearLayout ,它的理解很简单:在LinearLayout 里面的控件,按照水平或者垂直排列:
orientation="horizontal" :水平排列;orientation=" vertical" :垂直排列
当LinearLayout 是horizontal ,并且里面的控件使用了layout_width="fill_parent" ,第二组控件会挡在屏幕的右边,那也就是看不到了。。。
AbsoluteLayout ,是一个按照绝对坐标定义的布局,由于使用绝对坐标去定位控件,因此要实现自适应界面时,应尽少使用 AbsoluteLayout 。 AbsoluteLayout 里面的控件都以layout_x 、layout_y 来定义其位置:
上图中的TextView01的X坐标为10px,Y坐标为10px:
- Android入门第二篇之LinearLayout、AbsoluteLayout
- Android入门第二篇之LinearLayout、AbsoluteLayout
- Android入门第二篇之LinearLayout、AbsoluteLayout
- Android入门第二篇之LinearLayout、AbsoluteLayout
- Android入门第二篇之LinearLayout、AbsoluteLayout
- Android入门第二篇之LinearLayout、AbsoluteLayout .
- Android入门第二篇之LinearLayout、AbsoluteLayout
- Android入门第二篇之LinearLayout、AbsoluteLayout
- Android之LinearLayout、AbsoluteLayout
- 小记Android之LinearLayout,AbsoluteLayout,FrameLayout
- Android 五大布局FrameLayout,LinearLayout ,AbsoluteLayout...
- Android 布局(LinearLayout\TableLayout\RelativeLayout\AbsoluteLayout\FrameLayout)
- Android 布局(LinearLayout\TableLayout\RelativeLayout\AbsoluteLayout\FrameLayout)
- Android布局:LinearLayout、FrameLayout和RelativeLayout,AbsoluteLayout
- Android基础教程(二)之五大布局对象---FrameLayout,LinearLayout ,AbsoluteLayout,RelativeLayout,TableLayout.
- Android基础教程(二)之五大布局对象---FrameLayout,LinearLayout ,AbsoluteLayout,RelativeLayout,TableLayout.
- Android基础教程(二)之五大布局对象---FrameLayout,LinearLayout ,AbsoluteLayout,RelativeLayout,TableLayout.
- Android基础教程(二)之五大布局对象—FrameLayout,LinearLayout ,AbsoluteLayout,RelativeLayout,TableLayout
- Cheat Engine Tutorial v3--翻译Cheat Engine 6.1 tutorial(5)
- eeprom驱动实例(35内核下)
- PHP“Cannot use object of type stdClass as array”
- ABAP中的各种接口技术
- C操作文件属性
- Android入门第二篇之LinearLayout、AbsoluteLayout
- scp的使用和操作
- Android入门第三篇之RelativeLayout、FrameLayout
- 一个不错的可以免费下载的科技论文网站
- 按照指定格式显示数据表数据
- C语言十进制转化为十六进制程序设计
- Oracle ERP系統借贷关系表
- Android入门第四篇之TableLayout (一)
- Android入门第五篇之TableLayout (二)