读书人

android RelativeLayout 格局管理器

发布时间: 2012-07-25 09:43:06 作者: rapoo

android RelativeLayout 布局管理器

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. 显示结果

?

android RelativeLayout 格局管理器

?

?

?

读书人网 >Android

热点推荐