Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 911
user3289078 Avatar asked Oct 21 '25 07:10

user3289078


2 Answers

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>
like image 120
Hamid Shatu Avatar answered Oct 23 '25 20:10

Hamid Shatu


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: 
like image 21
Zied R. Avatar answered Oct 23 '25 21:10

Zied R.