Question: I am making a custom grid-view in android studio, every cell consist of an image-view and a text-view, but it gives an extra space between the the top and the image, and between the image and the text, see the [Image](https://i.stack.imgur.com/zRZWV.png). i want to get rid of that extra space, but i can't figure out the solution !

Here is the code of the Item (Cell) Layout:

```
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:weightSum="5">

<ImageView
    android:id="@+id/picture"
    style="@style/Pic" />

<TextView
    android:id="@+id/label"
    style="@style/Text" />

```

And here is the XML for my main layout:

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary">

<TextView
    style="@style/Main_Text"
    android:text="@string/Main_Menu"/>

<GridView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/gridView"
    android:numColumns="3"
    android:horizontalSpacing="10dp"
    android:verticalSpacing="10dp"/>

```

Answer: 
remove weightsum and in your imageview just add

```
android:adjustViewBounds="true"
android:scaleType="fitXY"

```

and if you want to use weightsum then try to add layoutweight for imageview and textview
Remove "android:verticalSpacing="0dip" from your code or You can try this ,

```
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mGridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:cacheColorHint="@android:color/transparent"
android:columnWidth="40dip"
android:horizontalSpacing="0dip"
android:numColumns="auto_fit"
android:scrollbars="none"
android:verticalSpacing="0dip" />

```