<?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" >
<LinearLayout
android:id="@+id/FirstLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/FirstTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT_ONE" />
</LinearLayout>
<LinearLayout
android:id="@+id/SecondLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/FirstLinearLayout"
android:orientation="horizontal">
<TextView
android:id="@+id/SecondTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT_TWO" />
<TextView
android:id="@+id/ThirdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT_Three" />
</LinearLayout>
First you will need a container to hold all of your components inside; in my example the container I am talking about is the RelativeLayout
. Relative Layouts allow their children to be placed in their position using the corresponding IDs. Take a look at how I positioned the other two LinearLayout
s using android:layout_below="@+id/FirstLinearLayout"
.
If you really insist on having them in the same Layout, use a relative layout and position the TextView
s as follows:
<?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" >
<TextView
android:id="@+id/FirstTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT_ONE" />
<TextView
android:id="@+id/SecondTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/FirstTextView"
android:text="TEXT_TWO" />
<TextView
android:id="@+id/ThirdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/FirstTextView"
android:layout_toRightOf="@+id/SecondTextView"
android:text="TEXT_Three" />
</RelativeLayout>
I hope this helps you out.