2
我已經在用於顯示應用程序中的通信數據的表格佈局時遇到了一些問題。問題是通信數據的值可能比可用的寬度長,所以文本被截斷了,看起來不太好。TextView在TableLayout中不會被截斷,儘管使用的是ellipsize屬性
爲了解決這個問題,我GOOGLE了一點點,發現了幾個解決方案,建議使用的TableLayout的shrinkColumns
屬性和應該得到截斷的TextView的android:ellipsize
。
這是表
...
<TableLayout android:id="@+id/table"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:shrinkColumns="1"/>
...
表中的行獲得使用下面的排佈置運行時膨脹的XML。
<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>
我不知道我在做什麼錯,但是這讓我瘋狂。任何建議如何解決這個問題或如何找到它不起作用的原因?