Empty space at the end of RecyclerView

1k Views Asked by At

I use LinearLayoutManager to show RecyclerView list horizontally

XML

    <android.support.v7.widget.RecyclerView
        android:id="@+id/dailyOffersList"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

Code

dailyOffersList.adapter = DailyOffersListAdapter(dailyOffer)
dailyOffersList.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)

It is XML of item and it has width as wrap_content https://codeshare.io/5XnldM

But there empty space int the end of list, and it happens only if it horizontally, like this

enter image description here

in the end

enter image description here

1

There are 1 best solutions below

0
On

Change the match_parent in the xml to wrap_content.

match_parent is supposed to fill the whole with of the screen.