RelativeLayout textviews overlapping

android, android-layout

Solution

    android:layout_toLeftOf="@id/tournament_winner" in First TextView.

Also set `android:maxLines="1"` and `Fix width for tournament winner` because when it gets long tournament name cant see...

row.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/tournament_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@id/tournament_winner"
        android:maxLines="1"
        android:text="NAMEEEEEEEEEEEEEEEEEEEEEEEEEEE"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/tournament_winner"
        android:layout_width="wrap_content" android:layout_marginLeft="10dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:text="WINER"
        android:textSize="25dp" />

</RelativeLayout>

Problem

I have a rather simple ListView row: ``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:id="@+id/tournament_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:textSize="25dp" /> <TextView android:id="@+id/tournament_winner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:textSize="25dp" /> </RelativeLayout> ``` When the text of `"@+id/tournament_name"`is long - it overlaps with the one from `"@+id/tournament_winner"` and I don't understand why. I tried using `android:singleLine="false"`to no avail. I also tried using `android:inputType="textMultiLine"`as the docu says `android:singleLine="false"` is deprecated but then I get the warning: `Attribute android:inputType should not be used with <TextView>: Change element type to <EditText> ?` so no good here as well. I also tried using `android:ellipsize="end"` but this doesn't work. I assume it is because the text in the left `TextView ("@+id/tournament_name")` is NOT long enough to fill up the full width of the `ListView` (which code is not sowing here). I was sure that if I use `android:layout_width="wrap_content"`the two TextView fields shouldn't overlap. Here is an example (see the second line): Any further ideas how this could be fixed?

Original source