简体   繁体   中英

Textview that doesn't show full text

I'm creating a simple layout with a TableLayout and TableRow, that contain two TextViews. This is a part of code.

<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>

The problem is that if there is long text in TextView1 then full text is not showing. How can I show full text in TextView1?

Try out the update XML what have you given in question...may be this is what you wanted to do.

<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>

to display multiple lines add :

android:ellipsize="none" //the text is not cut on textview width:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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