Loading

Wednesday, June 22, 2011

A example of RelativeLayout, layout_alignParentTop, layout_alignParentBottom and layout_above

It's a example of using RelativeLayout; place a button (or any other view) on top of screen, a button on bottom of screen, and another button place related to another view.

A example of RelativeLayout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Button on Top"
/>
<Button
android:id="@+id/buttonOnBottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Button on Bottom"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/buttonOnBottom"
android:text="Button Above Button on Bottom"
/>
</RelativeLayout>
</LinearLayout>


SHARE TWEET

Thank you for reading this article A example of RelativeLayout, layout_alignParentTop, layout_alignParentBottom and layout_above With URL http://x-tutorials.blogspot.com/2011/06/example-of-relativelayout.html. Also a time to read the other articles.

0 comments:

Write your comment for this article A example of RelativeLayout, layout_alignParentTop, layout_alignParentBottom and layout_above above!