Java Android TableView和TextView作为单元格-如何将TextView设置为多行

Java Android TableView和TextView作为单元格-如何将TextView设置为多行,java,android,eclipse,textview,Java,Android,Eclipse,Textview,我有一个以TextView作为单元格元素的TableView。目前,我无法设置布局文件,以便文本宽度大于单元格宽度时,文本视图文本是多行的。最终,表格单元格的增长宽度总是超过屏幕宽度。如何解决此问题?尝试以下方法: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill

我有一个以TextView作为单元格元素的TableView。目前,我无法设置布局文件,以便文本宽度大于单元格宽度时,文本视图文本是多行的。最终,表格单元格的增长宽度总是超过屏幕宽度。如何解决此问题?

尝试以下方法:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical">
    <TableLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:stretchColumns="*"
        android:id="@+id/tableLayout1">
        <TableRow android:id="@+id/tableRow1" android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <TextView android:text="test1" android:layout_width="fill_parent"
                android:layout_height="wrap_content" android:layout_weight="0" />
            <TextView android:layout_weight="1"
                android:text="test2 very long text that needs to be wrapped properly using layout_weight property and ignoring singleline since that is set by default..."
                android:layout_width="fill_parent" android:layout_height="wrap_content" />
        </TableRow>     
    </TableLayout>
</LinearLayout>

为文本视图设置一个固定的宽度,所有内容都会正常工作