Java – Textview that does not display full text

Textview that does not display full text… here is a solution to the problem.

Textview that does not display full text

I’m using TableLayout and TableRow to create a simple layout with two TextViews. This is part of the 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, the full text is not displayed. How do I display full text in TextView1?

Solution

Try to update the XML, you give the problem… Probably what you want 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>

Related Problems and Solutions