SK9*_*SK9 49 android multiline tablelayout textview tablerow
我正在显示一个带有行的TableLayout,如下所示:
<?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>
Run Code Online (Sandbox Code Playgroud)
我正在使用我能在这里找到的所有东西,并且可以想到允许文本包裹在许多行上,但无济于事:文本总是被强制为一行,从屏幕上运行.我在这里工作在TableRow中可能很重要,据我所知,这个网站没有得到处理.
那么,如何强制我的第二个TextView包装到多行呢?
Mic*_*ann 98
如果文本的列设置为缩小,TextView将包装文本.有时它不会完全包裹,如果文本以",..."结尾,那么它比n行更长一点.
这是一个例子,带有id的TextView question
将换行:
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="*">
<TableRow>
<TextView
android:id="@+id/question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
SK9*_*SK9 14
为了完整起见,这是我TableLayout
读取XML的方式:
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:shrinkColumns="0"
android:stretchColumns="0"
android:id="@+id/summaryTable">
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
我后来用TableRow
s 填充了这个.
归档时间: |
|
查看次数: |
63771 次 |
最近记录: |