Margin/padding in last Child in RecyclerView Margin/padding in last Child in RecyclerView android android

Margin/padding in last Child in RecyclerView


This issue is even easier to solve. You can apply necessary padding to the RecylerView itself and set clipToPadding to false, otherwise, the padding will chop off your scrolling area. Here is an example

<android.support.v7.widget.RecyclerView    android:padding="4dp"    android:clipToPadding="false"    android:layout_width="match_parent"    android:layout_height="match_parent" />

See the padding will add 4dp on all sides including top and bottom. Then the clipToPadding parameter makes sure your child items are not chopped off. Now, add 4dp padding to all sides for your child items, and you are good to go. In total you get 8dp padding on sides and between items.


Instead of adding padding to both the top and bottom items, You can just add the padding to the top and bottom of your RecyclerView and set the clipToPadding attribute to false.

<android.support.v7.widget.RecyclerView    android:layout_width="match_parent"    android:layout_height="match_parent"    android:clipToPadding="false"    android:paddingTop="8dp"    android:paddingBottom="8dp" />


<android.support.v7.widget.RecyclerView    android:id="@+id/rv_tpf"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:clipToPadding="false"    android:paddingBottom="100dp" />

Add android:clipToPadding="false" and android:paddingBottom="100dp" in your recyclerview.