У меня есть GridView, который состоит из двух столбцов. GridView содержит LinearLayout в качестве каждого элемента. Однако между элементами есть пробел.
Мой xml код для GridView ниже:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
tools:context=".DisplayAndCompare"
android:padding="10dp"
android:orientation="vertical"
android:layout_centerVertical="true"
>
<ImageView
android:id="@+id/imageView"
android:layout_width="300dp"
android:layout_height="100dp"
android:layout_marginTop="25dp"
android:layout_centerHorizontal="true"
android:src="@drawable/logo" />
<TextView
android:id="@+id/pgk_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="PACKAGES"
android:textColor="#3b4350"
android:textSize="20sp"
android:textStyle="bold"
android:typeface="normal"
android:layout_centerHorizontal="true"
android:layout_below="@id/imageView"/>
<GridView
android:id="@+id/pckg_details"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_marginTop="10dp"
android:numColumns="2"
android:layout_centerHorizontal="true"
android:layout_below="@id/pgk_search"
/>
<Button
android:id="@+id/btn_season"
android:layout_width="345dp"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:padding="15dp"
android:text="compare"
android:textSize="18sp"
android:layout_centerHorizontal="true"
android:layout_below="@id/pckg_details"
/>
</RelativeLayout>
Мой xml код для LinearLayout ниже:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="150dp"
app:srcCompat="@drawable/flag" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="TextView"
android:textSize="18sp"
android:textStyle="bold"
android:gravity="center" />
</LinearLayout>
Ниже приведен скриншот приложения.
Я хочу удалить пустое пространство под каждым элементом (LinearLayout) внутри GridView. Как это сделать?