I need ImageButtons to have equal height and width, with no spaces between one another like in the picture below, and there must not be such blank spaces at the beginning and at the end of matrix
Thank you very much! P.S. the code I used here was`
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
android:layout_marginTop="-4.5dp"
android:paddingBottom="-5dp"
android:paddingLeft="-5dp"
android:paddingRight="-5dp"
android:paddingTop="-5dp" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageButton
android:layout_height="fill_parent"
android:id="@+id/ImageButton_11"
android:layout_width="0dp"
android:layout_weight="1"
/>
<ImageButton
android:id="@+id/ImageButton_12"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_marginLeft="-8.5dp"
android:layout_weight="1" />
<ImageButton
android:id="@+id/ImageButton_13"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_14"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_15"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp" >
<ImageButton
android:id="@+id/ImageButton_21"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1" />
<ImageButton
android:id="@+id/ImageButton_22"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_23"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_24"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_25"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp" >
<ImageButton
android:id="@+id/ImageButton_31"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1" />
<ImageButton
android:id="@+id/ImageButton_32"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_33"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_34"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_35"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp"
>
<ImageButton
android:id="@+id/ImageButton_41"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1" />
<ImageButton
android:id="@+id/ImageButton_42"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_43"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_44"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_45"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
</TableRow>
<TableRow
android:id="@+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp" >
<ImageButton
android:id="@+id/ImageButton_51"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1" />
<ImageButton
android:id="@+id/ImageButton_52"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_53"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_54"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
<ImageButton
android:id="@+id/ImageButton_55"
android:layout_width="0dp"
android:scaleType="centerCrop"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginLeft="-8.5dp"
/>
</TableRow>
</TableLayout>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/refresh_ImageButton"
/>
</LinearLayout>
Now I want it to be done programmatically.