开发者

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

开发者 https://www.devze.com 2023-02-26 16:12 出处:网络
I have three rows and in that I want to fix these rows size equal and it will be based开发者_如何学Python upon the size of screen which we are giving to this table as whole,means it will divide three

I have three rows and in that I want to fix these rows size equal and it will be based开发者_如何学Python 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>


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

0

精彩评论

暂无评论...
验证码 换一张
取 消