我正在使用TableLayout和TableRow创建一个包含两个TextView的简单布局。这是代码的一部分。
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0">
<TableRow android:id="@+id/myTableRow">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dip"
android:text="Short description"/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dip"
android:text="Large description"/>
</TableRow>
问题是如果TextView1中有长文本,则不显示全文。如何在TextView1中显示全文?
答案 0 :(得分:4)
尝试更新XML您所提供的问题......可能这就是您想要做的事情。
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow android:id="@+id/myTableRow" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dip"
android:text="Short description" />
<TextView
android:id="@+id/textView1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="15dip"
android:text="Large description" />
</TableRow>
</TableLayout>
答案 1 :(得分:2)
显示多行添加:
android:ellipsize="none"
//文字未在文字视图宽度上剪切:
android:scrollHorizontally="false" //the text wraps on as many lines as necessary: