I am trying to create this using table layout but unable to sort out the weight ratio. i tried several combinations but they turn out to be disaster. can someone guide me through weight distribution of such design.
'
<?xml version="1.0" encoding="utf-8"?> <TableLayout android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="2" android:weightSum="8"> <TableRow android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" > <ImageButton android:layout_height="wrap_content" android:layout_weight="0.25" android:layout_width="wrap_content" android:background="@drawable/Image_1"/> <ImageButton android:layout_height="wrap_content" android:layout_weight="0.25" android:layout_width="wrap_content" android:background="@drawable/Image_1" /> </TableRow> <TableRow android:layout_height="wrap_content" android:layout_weight="2" android:layout_width="wrap_content" > <ImageButton android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:background="@drawable/Image_1"/> <ImageButton android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:background="@drawable/Image_1" /> </TableRow> <TableRow android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" > <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1"/> <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1" /> </TableRow> <TableRow android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" > <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1"/> <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1" /> </TableRow> <TableRow android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" > <ImageButton android:layout_height="wrap_content" android:layout_weight="0.25" android:layout_width="wrap_content" android:background="@drawable/Image_1"/> <ImageButton android:layout_height="wrap_content" android:layout_weight="0.25" android:layout_width="wrap_content" android:background="@drawable/Image_1" /> </TableRow> <TableRow android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" > <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1"/> <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1" /> </TableRow> <TableRow android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" > <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1"/> <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1" /> </TableRow> <TableRow android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" > <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1"/> <ImageButton android:layout_height="wrap_content" android:layout_weight="0.5" android:layout_width="wrap_content" android:background="@drawable/Image_1" /> </TableRow> </TableLayout> '
No comments:
Post a Comment