BilalMH BilalMH - 19 days ago 9
Android Question

RecyclerView Item gap is too big

I've been stuck on this problem for a few days and trying to look all over here and tried quite a few of the things that didn't work. Basically I'm having a huge gap between items in my RecyclerView Look at bottom and top of each text underneath My favourite topics

Here's the code for my RecyclerView

<android.support.v7.widget.RecyclerView
android:id="@+id/favouriteTopicRecycler"
android:layout_width="match_parent"
android:layout_height="150dp"
android:paddingStart="12dp"
android:layout_marginTop="10dp"
android:visibility="gone"/>


and here's the list item for the RecyclerView

<TextView
android:id="@+id/favTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:background="@android:color/transparent"
android:textSize="12sp"
android:clickable="true" />


I really don't know what I'm doing wrong, can anyone help? Thank you in advance.

Answer

Do the parent tag in list item height is match_parent ? if yes then make it wrap_content and the issue will be resolved. In the updated gradle of recycle view it is done that if the item is match parent it will take the height of the whole page, by doing wrap_content it will solve your issue.