Handle Overflowing Text in TextView
<p>I have a layout where I show some amount next to person's name. I have set it in <code>LinearLayout</code> and provided weigh to put it exactly when laied out in list. But if my amount value goes larger, it splits into the 2 row which I don't want. If amount is large, name should be shrink to show full amount. </p>

<p>It looks like this when amount is small:</p>

<p><a href="https://i.stack.imgur.com/pIR6v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pIR6v.png" alt="enter image description here"></a></p>

<p>My layout file is below:</p>

<pre><code>&lt;LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:paddingBottom="5dp"
    android:paddingTop="5dp"&gt;

    &lt;ImageView
        android:id="@+id/contact_image"
        style="@style/ContactImageView.ExtraSmall"
        app:contactBadge="@{contact}" /&gt;

    &lt;TextView
        android:id="@+id/contact_name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_weight="3"
        android:gravity="left"
        android:ellipsize="end"
        android:maxLines="1"
        android:text="@{contact.name}"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/black" /&gt;

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/colon" /&gt;

    &lt;TextView
        android:id="@+id/amount"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="end"
        app:amount="@{amount}"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/black" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>I am handling overflowing name with <code>ellipsize="end"</code>. But, full amount should be shown full. It can not be cut to show 3 dots of overflowing. </p>

<p>What layout changes will do the trick? Thanks.</p>