简单的RelativeLayout布局使用
来源:互联网 发布:数控编程与加工 编辑:程序博客网 时间:2024/04/27 14:00
记忆力随年龄减退了,干脆一些小知识点,也记录下来。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="10dp" tools:context=".MainActivity" > <!-- android:padding此处定义整个布局和Activity四周距离,和网页的padding类同 --> <!-- layout_marginTop 组件距离布局顶部距离 dp是单位 layout_toLeftOf组件左边缘 对齐靠近指定id的组件。 --> <TextView android:id="@+id/user" android:layout_marginTop="15dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20dp" android:layout_toLeftOf="@+id/passtext" android:text="用户:" /> <!-- layout_toRightOf组件右边缘靠近指定id的组件左边缘 layout_alignBottom 组件底部和指定id的组件底部对齐 --> <EditText android:id="@+id/usertext" android:layout_toRightOf="@id/user" android:layout_alignBottom="@id/user" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="username" /> <!-- layout_alignBottom 组件底部和指定id的组件底部对齐 --> <TextView android:id="@+id/pass" android:layout_alignBottom="@id/passtext" android:textSize="20dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="密码:" /> <!-- layout_toRightOf组件右边缘靠近指定id的组件左边缘 layout_below 组件处于指定id的组件下部 --> <EditText android:id="@+id/passtext" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/usertext" android:layout_toRightOf="@id/pass" android:text="password" /> <!-- layout_alignParentRight 组件和父布局右边靠近对齐 layout_below 位于指定id组件下部 --> <Button android:id="@+id/cancel" android:text="cancel" android:layout_alignParentRight="true" android:layout_below="@id/passtext" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button> <!-- layout_toLeftOf 组件左边缘和指定id组件右边缘靠近对齐 layout_below 位于指定id组件下部 --> <Button android:id="@+id/ok" android:text="ok" android:layout_toLeftOf="@id/cancel" android:layout_below="@id/passtext" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button></RelativeLayout>
布局效果图:
- 简单的RelativeLayout布局使用
- 相对布局(RelativeLayout)的简单使用
- RelativeLayout的布局
- Relativelayout布局的bug
- RelativeLayout 布局的运用
- RelativeLayout布局的属性
- 用RelativeLayout 实现简单的九宫格布局
- 简单的RelativeLayout 相对布局 及其常用属性
- android中使用RelativeLayout布局
- RelativeLayout的一些布局属性
- android的Relativelayout布局属性
- RelativeLayout(相对布局)的分析
- RelativeLayout布局的各种属性
- RelativeLayout布局的一点坑
- Android之简单布局LinearLayout和RelativeLayout
- Android RelativeLayout布局的相对布局
- RelativeLayout布局
- RelativeLayout布局
- POJ 3150 矩阵快速幂
- input device
- 关于ISCC2013的思路整理
- LKM
- 基类与派生
- 简单的RelativeLayout布局使用
- 《Effective C++》简明笔记-上
- 多线程导致内存溢出。什么原因?
- javascript 捕获和冒泡(二)
- 透过现象看本质!转自酷客http://coolshell.cn/articles/4102.html
- Android lunch分析以及产品分支构建
- 项目中配置了spring Security3 的并发session管理,一直无效
- 《Effective C++》简明笔记-中
- C/C++中三种方法显示当前系统时间 localtime time.h