0

I have a table with multiple rows similar to this:

<TableRow
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="text"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textSize="12sp"
        android:layout_gravity="right|center_vertical"
        android:layout_margin="4dip" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="some text"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="13sp"
        android:textStyle="bold"
        android:layout_gravity="left|center_vertical"
        android:layout_margin="4dip"
        android:ellipsize="end"
        android:lines="1"
        android:scrollHorizontally="true"
        android:layout_weight="1" />

    <ImageView
        android:src="@drawable/disclosure_indicator"
        android:contentDescription="@string/emptyString"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:scaleType="fitXY" />

</TableRow>

But the 2nd textview has it's last 'word' replaced with '...' if any row in the text view is wider than the remaining space.

So using something like:

"Some sort string"
"Some string that is a little bit longer"
"Singleword"

The table will render like so:

text | Some short...                       | >
text | Some string that is a little bit... | >
text |                                     | >

When clearly there is enough space to display the whole string for the first row. How can I get it so truncation/elipsis works correctly for each row?

MarSara9
  • 1
  • 3

1 Answers1

-1

@MarSara9 Change the layout gravity of the 2nd text view. This solution worked with your sample code :

android:layout_gravity="center_vertical"

lini sax
  • 911
  • 1
  • 11
  • 15