Ansh
Ansh

Reputation: 2396

TableRow Height is not increasing according to content in android TableLayout?

I am using TableLayout in Android which has three TableRow elements.Each TableRow element has two childs (both TextView).My problem is that when I am putting data in these TextView , the height of the cell is not increasing according to the content and its showing incomplete data.My xml looks like this:

<TableLayout
        android:id="@+id/pTable"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="5.0dip"
        android:layout_marginRight="5.0dip"
        android:layout_marginTop="10.0dip" >

        <TableRow
            android:id="@+id/fHeader"
            android:background="@drawable/uppar"
            android:padding="10.0dip" >

            <ImageView
                android:id="@+id/fImage"
                android:src="@drawable/ic_bs" />

            <TextView
                android:id="@+id/fText"
                android:layout_gravity="center_vertical"
                android:text="Test"
                android:textColor="@color/black"
                android:textStyle="bold" />
        </TableRow>

        <TableRow
            android:id="@+id/feFrom"
            android:background="@drawable/middle"
            android:padding="5.0dip" >

            <TextView
                android:id="@+id/coloumnFrom"
                android:layout_marginLeft="10dp"
                android:text="From :"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/coloumnFromValue"
                android:layout_marginLeft="20dp"
                android:text=""
                android:textStyle="bold" />
        </TableRow>

        <TableRow
            android:id="@+id/fDestination"
            android:background="@drawable/middle"
            android:padding="5.0dip" >

            <TextView
                android:id="@+id/coloumnDestination"
                android:text="To :"
                android:layout_marginLeft="10dp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/coloumnDestinationvalue"
                android:layout_marginLeft="20dp"
                android:text=""
                android:textStyle="bold" />
        </TableRow>

        <TableRow
            android:id="@+id/fVia"
            android:background="@drawable/middle"
            android:padding="5.0dip" >

            <TextView
                android:id="@+id/coloumnVia"
                android:layout_marginLeft="10dp"
                android:text="Via :"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/coloumnViaValue"
                android:layout_marginLeft="20dp"
                android:text=""
                android:textStyle="bold" />
        </TableRow>
    </TableLayout>

In third TableRow I have two TextView.One has "Via" as text in it and other has 200 characters data.But its displaying only 70 characters.I tried increasing height of the cell and row but nothing worked.Please help ...

Upvotes: 2

Views: 1009

Answers (1)

bmaciejm
bmaciejm

Reputation: 130

This topic is still actual?

Maybe try to use android:layout_weight="1" for each of your TableRows. It should force them to scale in proper way.

Upvotes: 2

Related Questions