János
János

Reputation: 35060

How to remove extra, default padding in RecycleView?

I have a horizontally ordered RecycleView and I want to remove extra empty space between elements. How? The structure of the RecycleView is like below.

enter image description here

<android.support.v7.widget.RecyclerView
    android:id="@+id/userSettingList"
    android:layout_marginLeft="120dp"
    android:layout_marginTop="0dp"
    android:layout_marginRight="0dp"
    android:layout_height="66dp"
    android:layout_width="match_parent"
    />

And here is the row item xml:

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

    <ImageView
        android:id="@+id/icon"
        android:layout_width="66dp"
        android:layout_height="66dp"
        android:padding="0dp" />

</RelativeLayout>

Upvotes: 0

Views: 2834

Answers (1)

Moulesh
Moulesh

Reputation: 2810

Make the Relative layout in your row item to wrap content i mean android:layout_width="wrap_content" android:layout_height="wrap_content"

Upvotes: 2

Related Questions