【发布时间】:2012-02-02 08:50:48
【问题描述】:
设置到 textView22 的文本数据超出宽度。理想情况下,剩余文本应位于同一表格行的下一行,但文本会被截断。如何在同一 TableRow 中以多行显示文本?
下面的代码有一行两列。
<TableLayout android:id="@+id/first_table"
android:layout_width="match_parent" android:layout_height="match_parent"
android:background="@drawable/table_shape" android:layout_marginTop="10dp"
android:layout_marginLeft="20dp" android:layout_marginRight="20dp">
<TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:isScrollContainer="true">
<TextView android:id="@+id/textView21"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="5dp" android:textColor="@color/black"
android:text="@string/to_" android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="right">
</TextView>
<TextView android:id="@+id/textView22"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="5dp" android:textColor="@color/black"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="left" android:maxLines="10"
android:scrollbars="vertical">
</TextView>
</TableRow>
</TableLayout>
【问题讨论】:
-
尝试删除
maxLines并添加singleLine="false" -
你想在单行中显示所有数据吗?
-
我需要在 TableRow 的特定列(TextView)中显示超出宽度的项目列表
标签: android