Android align contents of a table -
i'm struggling contents of table cell align left/right. code is:
<tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tablelayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" > <tablerow android:id="@+id/tablerow4" android:layout_weight="1" > <imagebutton android:id="@+id/button_one" android:layout_height="fill_parent" android:layout_weight="1" android:adjustviewbounds="true" android:background="@null" android:scaletype="fitcenter" android:src="@drawable/button_one" /> <imagebutton android:id="@+id/button_two" android:layout_height="fill_parent" android:layout_weight="1" android:adjustviewbounds="true" android:background="@null" android:scaletype="fitcenter" android:src="@drawable/button_two" /> </tablerow> ....
i'd 2 imagebutton's fit snuggly in middle @ moment there gap - looks each cell centering contents. table expands full size of screen , there 4 rows in total same above. want image buttons resize fill screen whilst maintaining aspect ratio.
i've tried setting gravity on image buttons doesn't seem work (it moves few pixels only).
you missing android:layout_width="0dp"
on buttons, allow layout weights function, making each button split available space equally.
Comments
Post a Comment