- 위치를 부모 또는 상호간 상대적으로 지정된다.
- 엘리먼트는 주어진 순서대로 렌더링 된다.
[code]
<?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="wrap_content"
android:background="@drawable/blue"
android:padding="10px" >
<TextView android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type here:" />
<EditText android:id="@+id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:layout_below="@id/label" /> // @id/label below 지정!!!!
<Button android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry" // @id/entry below 지정!!!
android:layout_alignParentRight="true"
android:layout_marginLeft="10px" // 정렬을 left 로
android:text="OK" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/ok" // @id/ok toLeftof 지정!!!
android:layout_alignTop="@id/ok"
android:text="Cancel" />
</RelativeLayout>
[/code]
http://developer.android.com/resources/tutorials/views/hello-relativelayout.html
- 엘리먼트는 주어진 순서대로 렌더링 된다.
[code]
<?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="wrap_content"
android:background="@drawable/blue"
android:padding="10px" >
<TextView android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type here:" />
<EditText android:id="@+id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:layout_below="@id/label" /> // @id/label below 지정!!!!
<Button android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry" // @id/entry below 지정!!!
android:layout_alignParentRight="true"
android:layout_marginLeft="10px" // 정렬을 left 로
android:text="OK" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/ok" // @id/ok toLeftof 지정!!!
android:layout_alignTop="@id/ok"
android:text="Cancel" />
</RelativeLayout>
[/code]
http://developer.android.com/resources/tutorials/views/hello-relativelayout.html
'Android' 카테고리의 다른 글
define colors (0) | 2013.10.08 |
---|---|
resources (0) | 2013.10.08 |
table layout (0) | 2013.10.08 |
linear layout (0) | 2013.10.08 |
frame layout (0) | 2013.10.08 |