Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TableLayout height does not fills the whole screen

I have a linear layout with just a single TableLayout in it. The Table Layout further has two rows with two columns each. First Table Row has two Images. Second Table Rows has two buttons.

But this does not show up on the complete screen, rather only shows on the first half or maybe depends on the image height. Both the images are actually same file, but shown with different Widths. Help please... here is the Layout file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:stretchColumns="*">

        <TableRow
            android:layout_height="fill_parent">

            <ImageView
                android:id="@+id/tp_image"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_weight="0.9"
                android:scaleType="fitXY"
                android:src="@drawable/images" />

            <ImageView 
                android:id="@+id/s_image"
                android:src="@drawable/images"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:scaleType="fitXY"
                android:layout_weight="0.1"
                />
        </TableRow>
        <TableRow >
            <Button 
                android:id="@+id/button_LC"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/button_LC"/>
            <Button 
                android:id="@+id/button_RC"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/button_RC"/>
        </TableRow>
    </TableLayout>
</LinearLayout>
like image 591
Anjanu Avatar asked Jul 24 '12 16:07

Anjanu


1 Answers

set

<TableRow
    android:layout_height="0dp"
    android:layout_weight="1" >

to both table rows or just to the first row.

like image 88
Prakash Nadar Avatar answered Oct 31 '22 11:10

Prakash Nadar