Last active
August 29, 2015 14:16
-
-
Save arod2634/915e7aa5edd3003f902d to your computer and use it in GitHub Desktop.
Android Relative Layout Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" | |
android:weightSum="1"> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="One" | |
android:id="@+id/textView" | |
android:layout_alignParentTop="true" | |
android:layout_alignParentLeft="true" | |
android:layout_alignParentStart="true" /> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Two" | |
android:id="@+id/textView2" | |
android:layout_alignParentTop="true" | |
android:layout_toRightOf="@+id/textView" | |
android:layout_toEndOf="@+id/textView" /> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Three" | |
android:id="@+id/textView3" | |
android:layout_alignParentTop="true" | |
android:layout_toRightOf="@+id/textView2" | |
android:layout_toEndOf="@+id/textView2" /> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Four" | |
android:id="@+id/textView4" | |
android:layout_alignParentTop="true" | |
android:layout_toRightOf="@+id/textView3" | |
android:layout_toEndOf="@+id/textView3" /> | |
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" | |
android:weightSum="1"> | |
<TextView | |
android:layout_width="200dp" | |
android:layout_height="150dp" | |
android:text="One" | |
android:id="@+id/textView" /> | |
<TextView | |
android:layout_width="200dp" | |
android:layout_height="150dp" | |
android:text="Two" | |
android:id="@+id/textView2" | |
android:layout_toRightOf="@+id/textView"/> | |
<TextView | |
android:layout_width="200dp" | |
android:layout_height="150dp" | |
android:text="Three" | |
android:id="@+id/textView3" | |
android:layout_below="@+id/textView" /> | |
<TextView | |
android:layout_width="200dp" | |
android:layout_height="150dp" | |
android:text="Four" | |
android:id="@+id/textView4" | |
android:layout_toRightOf="@+id/textView3" | |
android:layout_below="@+id/textView2" /> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment