Skip to content

Instantly share code, notes, and snippets.

@leonguyen
Last active December 15, 2015 21:59
Show Gist options
  • Select an option

  • Save leonguyen/5329563 to your computer and use it in GitHub Desktop.

Select an option

Save leonguyen/5329563 to your computer and use it in GitHub Desktop.
Android Lab: Relative Layout - Work - Defining an XML Layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/editTextMain"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textViewHour"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/editTextMain"
android:text="Hour" />
<EditText
android:id="@+id/editTextHour"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/editTextMain"
android:layout_toRightOf="@id/textViewHour"
android:gravity="left" />
<TextView
android:id="@+id/textViewMin"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_below="@id/editTextMain"
android:layout_toRightOf="@id/editTextHour"
android:text="Minute" />
<EditText
android:id="@+id/editTextTime"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/editTextMain"
android:layout_toRightOf="@id/textViewMin" />
<Button
android:id="@+id/buttonAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editTextTime"
android:layout_centerInParent="true"
android:text="Add work"
/>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment