【发布时间】:2011-01-07 07:07:53
【问题描述】:
我正在使用 TableLayout 来显示数据。 活动调用onCreate()时会设置右列TextView的文本。
现在,正如您在下图中看到的那样,我的地址文本可能很长并且应该被换行。
所以我设置了android:layout_width="wrap_content"。但它仍然需要屏幕大小的宽度来包装数据。
我该如何克服这个问题?
我的 xml:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5px">
<TableRow>
<TextView android:text="Job#"
android:paddingRight="5px" />
<TextView android:id="@+id/DetailJobNo" />
</TableRow>
<TableRow>
<TextView android:text="Address"
android:paddingRight="5px" />
<TextView android:id="@+id/DetailAddress"
android:layout_width="wrap_content"
android:text="Address Address Address Address Address Address Address Address "/>
</TableRow>
</TableLayout>
【问题讨论】:
标签: android android-layout android-tablelayout