title: Android align multiple TextView-s in line
body: <p>i am trying to align multiple (variable) textviews in one line. It should look like this:</p>
  
  <pre><code>- Textview1 | Textview2 | TextView3
  </code></pre>
  
  <p>Since the textviews vary regarding length  I am having a problem aligning them properly(the only thing I know is that Textview1 will be the shortest one). </p>
  
  <p>Here is my code (it is placed inside a Linear Layout): </p>
  
  <pre><code>        &lt;RelativeLayout
              android:id="@+id/persondetails_names_horizontal_container"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="right"
              android:gravity="right" &gt;
  
              &lt;TextView
                  android:id="@+id/persondetails_title"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="right"
                  android:paddingTop="3dp"
                  android:text=" Title "
                  android:layout_alignParentRight="true" /&gt;
  
              &lt;TextView
                  android:id="@+id/persondetails_name"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text=" Name "
                  android:textSize="@dimen/font_big"
                  android:textStyle="bold" 
                  android:layout_toEndOf="@id/persondetails_title"
                  android:layout_toRightOf="@id/persondetails_title" /&gt;
  
              &lt;TextView
                  android:id="@+id/persondetails_surname"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_toEndOf="@id/persondetails_name"
                  android:layout_toRightOf="@id/persondetails_name"
                  android:text=" Surname " /&gt;
  
          &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Now, as long as these 3 Textviews fill out one line on the screen everything is OK, but as soon as one of them gets bigger I get some problems. For example, when I put the <code>surname</code> field very long, it pushes the other 2 views out of the screen (they are not visible) and takes all the space (but just one line!).</p>
  
  <p>What I want is that these views are aligned to the right side, each of them to the right of the previous one, and when it is needed to linebreak into a new line (no mather which textview it is) and in the new line the following textviews should align to the right of it.</p>
  
  <p>So what do I need to change in my code, so that these Textviews are aligned next to each other, and moved properly when one of them is getting bigger ?</p>
  
  <p>Thank you</p>
  
  <p>This is how I implemented Elltz suggestions:    </p>
  
  <pre><code>     &lt;LinearLayout
              android:id="@+id/persondetails_namen_horizontal_container"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="right"
              android:gravity="right"
              android:orientation="horizontal"
              android:weightSum="2" &gt;
  
              &lt;TextView
                  android:id="@+id/persondetails_wert_titel"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="right" /&gt;
  
              &lt;TextView
                  android:id="@+id/persondetails_wert_vorname"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:layout_height="wrap_content"
                  android:layout_below="@id/persondetails_text_vorname"
                  android:gravity="right"
                  android:layout_gravity="right"
                  android:text=" "
                  android:ellipsize="marquee"
                  android:marqueeRepeatLimit="marquee_forever"
                  android:overScrollMode="always"
                  android:scrollHorizontally="true"
                  android:singleLine="true"/&gt;
  
              &lt;TextView
                  android:id="@+id/persondetails_wert_nachname"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:layout_height="wrap_content"
                  android:layout_below="@id/persondetails_text_vorname"
                  android:layout_gravity="right"
                  android:text=" "
                  android:ellipsize="marquee"
                  android:marqueeRepeatLimit="marquee_forever"
                  android:overScrollMode="always"
                  android:scrollHorizontally="true"
                  android:singleLine="true"/&gt;
          &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>But still not working. Actually I removed the "singleLine=true" because in case when one of the 3 textviews gets too long I need it break (don't have a problem with breaking). </p>
  
  <p>Regarding breaking, I want every textview to take as muche space as it needs, the only thing is that all the other views shoud be moved properly.</p>
  
  <p>The property "single line" cannot be right because it is possible that one of these views gets too long for one line, but I have tested it with single line and without:</p>
  
  <p>a) with "singleline=true"<img src="https://i.stack.imgur.com/2oKzf.png" alt="enter image description here"></p>
  
  <p>b) without "singleline=true" <img src="https://i.stack.imgur.com/xfxic.png" alt="enter image description here"></p>
  
  <p>In bothe cases I get a wrong output, but case 2 is closer to what I want. But if you look at it you will see that textview2 is being pushed and it breakes in its bounds but not on the entire lenght. Textview 3 takes the most space. But what i want is that every view is fully streched and if needed breaked into new line (textview1 is this "Mag.")</p>
  
  <p>This is how I would like it to look like:</p>
  
  <p><img src="https://i.stack.imgur.com/EzSwb.png" alt="enter image description here"></p>