TextViews are on top of each other - Android XML

android, textview, xml

Solution

<TextView
    android:layout_width="wrap_content"
    android:id= "@+id/textview1" 
    android:layout_height="wrap_content"
    android:text="@string/hello_world" />
<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id= "@+id/textview2" 
        android:layout_below="@+id/textview1"  
        android:text="@string/matttest" />

Use the layout below,above to place the views relative to each other

Problem

I just started to learn Android Development (with Android Studio), but I have some trouble. The TextViews on the activity_main.xml are placed on top of each other, instead of under each other. I just copied the default TextView and change the text to another string. ``` <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".Main"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/matttest" /> </RelativeLayout> ``` How can I make sure that the TextViews are placed under each other, instead of on top of each other? Thanks Matt

Original source