title: Place a TextView next to another TextView for longer text on Android
body: <p>My goal is to have 2 <code>TextView</code>s (<code>textLeft</code>, <code>textRight</code>) next to each other. <code>textLeft</code> should be aligned to the left side of parent. <code>textRight</code> should always be an immediate right of <code>textLeft</code> (not on the extreme right of device), and it should not be pushed out of screen if <code>textLeft</code> is too long.</p>
  
  <p>Horizontal <code>LinearLayout</code> is of no use here as using weights will fix the view size, and that's not desired.</p>
  
  <p>I have been using this <code>RelativeLayout</code> which works fine if <code>textLeft</code> is not too long. With longer texts, <code>textRight</code> is pushed off screen.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          tools:context=".TextAlignActivity"&gt;
  
      &lt;TextView
              android:id="@+id/textLeft"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textSize="10sp"
              android:maxLines="3"
              android:ellipsize="end"
              android:text="Text On the Left - long random text to follow"
      /&gt;
  
      &lt;TextView
              android:id="@+id/textRight"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_toEndOf="@+id/textLeft"
              android:layout_alignParentRight="true"
              android:textSize="10sp"
              android:maxLines="1"
              android:text="Text on the Right"
      /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I guess ConstraintLayout may be a good fit for such cases, but I am not very familiar. I would like to avoid that if possible, since it will need a heavy re-write of my existing layout.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <ol>
  <li><p>In order to simplify my query, I am using 2 <code>TextView</code>s in the example. In my app code <code>textLeft</code> is a vertical <code>LinearLayout</code> with 2 <code>TextViews</code> (<code>textLeftTop</code> and <code>textLeftBottom</code>) instead of a single <code>TextView</code> as shown in example. I am hoping the solution that works for 2 <code>TextViews</code> should also work for a <code>LinearLayout</code> and <code>TextView</code>.</p></li>
  <li><p>Based on the solutions so far, I should clarify that I need the <code>textRight</code> to be on immediate right of <code>textLeft</code> (not device right) if <code>textLeft</code> is not long. If <code>textLeft</code> is long, then <code>textRight</code> should "stick" to the device right, and <code>textLeft</code> should wrap text.</p></li>
  </ol>