android学习笔记5:绝对布局
2011-12-14 17:09
246 查看
在使用android的界面开发工具droiddraw的时候,你会发现,它的默认布局就是绝对布局,也就是用坐标来指定每一个控件的位置,这样的方法在直接拖控件的时候显的比较方便,但是不利于程序的推广和后期的调整,所以还是建议不使用绝对布局。下面的这个程序是用绝对布局做的一个登录界面,很简单,就只把xml文件贴出来了。
<?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- 定义一个文本框,使用绝对定位 --> <TextView android:layout_x="20dip" android:layout_y="20dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="用户名:" /> <!-- 定义一个文本编辑框,使用绝对定位 --> <EditText android:layout_x="80dip" android:layout_y="15dip" android:layout_width="wrap_content" android:width="200px" android:layout_height="wrap_content" /> <!-- 定义一个文本框,使用绝对定位 --> <TextView android:layout_x="20dip" android:layout_y="80dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="密 码:" /> <!-- 定义一个文本编辑框,使用绝对定位 --> <EditText android:layout_x="80dip" android:layout_y="75dip" android:layout_width="wrap_content" android:width="200px" android:layout_height="wrap_content" android:password="true" /> <!-- 定义一个按钮,使用绝对定位 --> <Button android:layout_x="130dip" android:layout_y="135dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="登 录" /> </AbsoluteLayout>
相关文章推荐
- Android学习笔记15:绝对布局管理器AbsoluteLayout
- Android学习笔记(16):绝对布局AbsoluteLayout、常用距离单位
- CSS:绝对定位布局案例 position布局实例
- 绝对布局和相对布局
- Android学习笔记:布局属性 layout_weight 解析
- Android学习笔记之RecyclerView(二)-异布局Item实现
- Android学习笔记 - 布局篇
- 06-相对布局和绝对布局
- Android学习笔记10---View布局
- div布局:相对定位、绝对定位、固定定位
- 控件默认布局为绝对定位设置
- android学习笔记(2.1)--7.20--(5中布局方式+android单位)
- Android学习笔记之布局
- web兼容行探究1:IE 6 select节点显示在绝对布局之上的解决方法
- duilib各种布局的作用,相对布局与绝对布局的的意义与用法
- Android五布局——绝对布局AbsoluteLayout
- Android学习笔记-Android非布局activity中布局文件及控件加载方法
- DIV CSS布局中绝对定位和浮动用法
- Android学习笔记之为Dialog自定义布局,并说明空指针问题
- android学习笔记4-几种常用布局的介绍