recyclerview margin bottom code example
Example 1: margin recyclerview android
class MarginItemDecoration(private val spaceHeight: Int) : RecyclerView.ItemDecoration() { override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { with(outRect) { if (parent.getChildAdapterPosition(view) == 0) { top = spaceHeight } left = spaceHeight right = spaceHeight bottom = spaceHeight } }}
Example 2: android recyclerview bottom padding
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="8dp"
android:paddingBottom="8dp" />