My problem is that some of my gridview items have a different height than others. I want that all items have the same width and height. Here is the code for the item layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container_categoria"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
android:gravity="center"
android:background="#232323"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView5"
android:layout_width="75dp"
android:layout_height="75dp"
android:paddingBottom="5dp"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/category_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Centro de Investigação de Exemplo" />
</LinearLayout>
And here is my main layout file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent" >
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="auto_fit"
android:verticalSpacing="5dp"
android:horizontalSpacing="5dp"
android:id="@+id/gridView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
And here is an image showing the problem: image with problem