I have use Tablelayout
to display 6 different images in a screen. Here is my xml code,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="vertical"
tools:context=".MainMenu" >
<TableLayout
android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="@+id/image1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
<ImageView
android:id="@+id/image2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="@+id/image3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
<ImageView
android:id="@+id/image4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="@+id/image5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
<ImageView
android:id="@+id/image6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
</TableRow>
</TableLayout>
</LinearLayout>
The output is like below image
I want to remove the space between two rows. How to do that ?
Try to add this android:scaleType="fitXY"
properties to all your ImageView and in xml