3

after I run my application I get large gap between RecyclerView items !! this is my code here : Github Large gap between recyclerview items

enter image description here

Ahmad Aghazadeh
  • 15,872
  • 11
  • 96
  • 94
Ridae HAMDANI
  • 666
  • 2
  • 7
  • 15

1 Answers1

10

Change your Layouts like this

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context="com.breuhteam.recyclerview.MainActivity">

<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:scrollbars="vertical" />
</RelativeLayout>

view_item.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/itemView"
    android:src="@drawable/diy"
    android:layout_margin="1dp"
    android:adjustViewBounds="true"/>
</RelativeLayout>
Uttam Panchasara
  • 5,420
  • 4
  • 24
  • 41