Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make rows equal in height as per screen height in Android device

Tags:

android

row

I have three rows and in that I want to fix these rows size equal and it will be based upon the size of screen which we are giving to this table as whole,means it will divide three rows equally as per given height,same is done for column by using android:stretchColumns="0,1". Tabel structure is attached below:

<TableLayout android:layout_width="fill_parent" android:id="@+id/tabelViewButtons"
        android:layout_marginTop="10dip" android:layout_height="fill_parent"
        android:layout_below="@id/searchbar" android:layout_above="@id/follow_notification_bar"
        android:fitsSystemWindows="true" android:stretchColumns="0,1"
        >
    <TableRow >
        <ImageButton android:layout_height="fill_parent"
            android:layout_width="fill_parent" android:padding="5dip"
            android:id="@+id/button_one"></ImageButton>
        <ImageButton android:layout_height="fill_parent"
            android:layout_width="fill_parent" android:padding="5dip"
            android:id="@+id/button_two"></ImageButton>
    </TableRow>

    <TableRow >
        <ImageButton android:layout_height="fill_parent"
            android:layout_width="fill_parent" android:padding="5dip"
            android:id="@+id/button_three"></ImageButton>

        <ImageButton android:layout_height="fill_parent"
            android:layout_width="fill_parent" android:padding="5dip"
            android:id="@+id/button_four"></ImageButton>
    </TableRow>
    <TableRow >
        <ImageButton android:layout_height="fill_parent"
            android:layout_width="fill_parent" android:padding="5dip"
            android:id="@+id/button_five"></ImageButton>
        <ImageButton android:layout_height="fill_parent"
            android:layout_width="fill_parent" android:padding="5dip"
            android:id="@+id/button_six"></ImageButton>

    </TableRow>
    >

</TableLayout>
like image 661
Sandeep Avatar asked Apr 19 '11 12:04

Sandeep


1 Answers

set the attribute android:layout_weight="1" for each TableRow

like image 121
pankajagarwal Avatar answered Sep 27 '22 19:09

pankajagarwal