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>
set the attribute android:layout_weight="1"
for each TableRow
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With