Use layout_toStartOf in the first item with second item +id under double quotes
<?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:orientation="horizontal" >
<TextView
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/selectaccount"
android:text="very long text which used to overlap over radio button"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RadioButton
android:id="@+id/selectaccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
note this argument in textview
android:layout_toStartOf="@+id/selectaccount"
An XML is read from top to bottom
so this is how the Layout is rendered in Android
- android:layout_toStartOf=”@id/item means that item is defined above this line
- android:layout_toStartOf=”@+id/item means that item will appear later somewhere below this line