1. 界面配置文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="12px"
>
<TextView
android:id="@+id/label_username"
android:text="@string/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/input_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="100px"
android:layout_below="@+id/label_username"
android:layout_alignParentRight="true"
android:layout_toLeftOf="@+id/label_username"
android:layout_alignTop="@+id/label_username"
/>
<TextView
android:id="@+id/label_password"
android:text="@string/password"
android:layout_below="@+id/input_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/label_password"
android:layout_alignParentRight="true"
android:layout_marginLeft="100px"
android:layout_toLeftOf="@+id/label_password"
android:layout_alignTop="@+id/label_password"
android:password="true"
/>
<Button
android:id="@+id/reset"
android:text="@string/reset"
android:layout_below="@+id/password"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:width="150px"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/login"
android:text="@string/login"
android:layout_below="@+id/reset"
android:layout_width="wrap_content"
android:layout_alignTop="@+id/reset"
android:layout_height="wrap_content"
android:width="150px"
android:layout_toLeftOf="@+id/reset"
/>
</RelativeLayout>
2. 显示结果
- 大小: 15.8 KB
分享到:
相关推荐
Android 相对布局 RelativeLayout 属性
Android中使用RelativeLayout布局完成的登录练习题要求说明.pdf 学习资料 复习资料 教学资源
Android相对布局RelativeLayout的基本用法,相对布局是最实用的布局。
Android 布局属性 RelativeLayout 详解 Android 布局属性 RelativeLayout 是 Android 中常用的布局方式之一,通过它可以实现复杂的界面布局。下面是 RelativeLayout 的主要属性详解: 第一类:属性值为 true 或 ...
android实现自定义RelativeLayout可拖动、缩放、旋转TextView
RelativeLayout是相对布局控件:以控件之间相对位置或相对父容器位置进行排列,下面通过本文给大家介绍Android布局之RelativeLayout相对布局,涉及到android relativelayout相对布局相关知识,对android ...
Android中使用RelativeLayout完成梅花布局的代码清单.pdf 学习资料 复习资料 教学资源
自己写的android相对布局demo,具体参照博客
相对布局我最新喜欢的布局,也是game开发,照相机以及增钱现实中最常用的布局!
Android中使用RelativeLayout布局完成的登录界面教学案例任务说明.pdf 学习资料 复习资料 教学资源
一个Android XML布局的例子,主要利用xml文件进行布局,里边用到的是RelativeLayout。具体的本例中: 非洲草原地图:用到了FrameLayout的使用;ActivityMain演示了linerLayout。 个性化表单ActivityLayout 演示...
Android布局入门,LinearLayout和RelativeLayout的理解和应用
RelativeLayout android 布局练习
Android中使用RelativeLayout布局完成登录的代码清单.pdf 学习资料 复习资料 教学资源
Android布局控件之RelativeLayout详解
总结android中相对布局RelativeLayout的所有属性及使用方法。适合初级程序员
Android 线性布局: AbsoluteLayout布局和RelativeLayout布局。 1、绝对布局 AbsoluteLayout 绝对定位AbsoluteLayout,又可以叫做坐标布局,可以直接指定子元素的绝对位置,这种布局简单直接,直观性强,但是由于...
这个程序写了对相对布局和绝对布局的例子,帮助大家理解两者的使用和区别。
RelativeLayout使用详解 包括属性方法详解 实现LinearLayout中weight属性 用 RelativeLayout实现计算器界面 具体参见博客 http://blog.csdn.net/a87b01c14/article/details/49466325
【Android开发学习25】界面布局之相对布局RelativeLayout(代码)