我顯示與行的TableLayout如下通過tablerow顯示在TextView中多行文字:Android和在
<?xml version="1.0" encoding="utf-8"?>
<TableRow
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/one"
android:layout_marginLeft="10dip"
android:textColor="#B0171F" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/one"
android:id="@+id/two"
android:layout_marginLeft="10dip"
android:ellipsize="none"
android:singleLine="false"
android:scrollHorizontally="false"
android:maxLines="10"
android:textColor="@android:color/black" />
</RelativeLayout>
</TableRow>
我打這一切我可以在這裏找到,可以想到的允許文本在多行上打包,但無濟於事:文本總是被強制爲一行,從屏幕上跑出。這可能很重要,我在這裏工作在TableRow中,而據我所知,這個網站上沒有對此進行處理。
那麼,我如何強制我的第二個TextView換行?
TableRow就是這樣一行。我認爲你不應該嘗試在單一行上創建多行,這就是重點。那裏使用TableRow的目的是什麼? – Klaus 2011-03-08 09:37:11
你嘗試刪除'android:singleLine =「false」'行嗎? – 2011-03-08 09:46:23
剛剛在Eclipse中複製了您的代碼,並且文本正確包裝,正如我在圖形佈局中看到的。 (我剛加了'android:text =「(長文本)」'有一些文字可以顯示) – Adinia 2011-03-08 09:46:43