繁体   English   中英

没有显示全文的Textview

[英]Textview that doesn't show full text

我正在使用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中显示全文?

尝试更新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>

显示多行添加:

android:ellipsize="none" //文本未在textview宽度上剪切:

android:scrollHorizontally="false"   //the text wraps on as many lines as necessary: 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM