Reputation: 27455
I've got some problems with a table layout I used to show communication data within an app. The problem is that the value of the communication data may be longer than the available width so the text got cut off what doesn't look very nice.
To solve this issue I googled a little bit and found several solutions that advise to use the shrinkColumns
attribute on the TableLayout and the android:ellipsize
on the TextView that should get truncated.
This is the xml for the table
...
<TableLayout android:id="@+id/table"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:shrinkColumns="1"/>
...
The rows of the table get inflated on runtime using following row layout.
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="fill_parent">
<TextView android:id="@+id/type_column_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:ellipsize="end"/>
<TextView android:id="@+id/value_column_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:ellipsize="end"
android:autoLink="all" />
</TableRow>
I don't know what I'm doing wrong but this drives me insane. Any suggestion how to solve this or how to find the reason why it doesn't work?
Upvotes: 2
Views: 783
Reputation: 5535
Remove the line that says:
android:inputType="text"
Then you should get ellipses.
Upvotes: 2