Android-使用绝对布局管理器固定组件的位置
来源:互联网 发布:南京java开发工资 编辑:程序博客网 时间:2024/06/05 13:26
使用绝对布局管理器
使用绝对布局管理器控制一个TextView组件和一个Button组件的绝对位置。
绝对布局管理器用表示,在使用该布局方式时,需要指定空间的x,y精确坐标
推荐使用XML布局文件中定义绝对布局管理器。
实现过程:
修改res/layout/main.xml文件,添加一个绝对布局管理器,然后分别添加一个TextView和一个Button组件,并分别通过android:layout_x和android:layout_y设置他们的绝对属性。
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <TextView android:layout_x="20px" android:layout_y="10px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="用户名" android:hint="请输入用户名" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="18dp" android:layout_y="56dp" android:text="密码" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="70dp" android:layout_y="2dp" android:ems="10" /> <EditText android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="70dp" android:layout_y="36dp" android:ems="10" android:inputType="textPassword" > <requestFocus /> </EditText> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="112dp" android:layout_y="116dp" android:text="确定" /></AbsoluteLayout>
0 0
- Android-使用绝对布局管理器固定组件的位置
- Android绝对布局管理器AbsoluteLayout
- Java绝对布局的编写-不使用布局管理器
- java--Swing 组件的使用 布局管理器
- Android开发之绝对布局的使用
- 绝对布局管理器
- Android布局管理器的介绍与使用
- 布局管理器的使用
- android-UI组件(一):布局管理器
- Android学习笔记15:绝对布局管理器AbsoluteLayout
- 06 绝对定位布局管理器
- swing 绝对布局的使用
- swing 绝对布局的使用
- Android-使用线性布局管理器布局
- 读书笔记--Android布局和UI组件中的布局管理器
- 使用BorderLayout布局管理器将组件进行布局
- Android开发7:布局管理器4(网格布局GridLayout,绝对布局AbsoluteLayout)
- Java布局管理器组件
- 第一次上机实验—2
- 自定义照相机官方指南
- 怎样做到开发的app更省电
- Spark容错机制
- 集体智慧编程(二)发现群组
- Android-使用绝对布局管理器固定组件的位置
- dhu4508(完全背包)
- java反射
- 第33讲项目2——求阶乘
- QQ群中一次问答面试题,供大家借鉴,哈哈
- 21. Merge Two Sorted Lists
- 学习Discuz! X3.2记录:又一个插件制作过程,主导航中增加一个连接(用简单模板重定向)
- 排序与查找的最好算法
- DLL获取当前文件目录和DLL调试方法