Skip to content

Instantly share code, notes, and snippets.

Android | Competitive Programming

Arpit Johri Arpit0492

Android | Competitive Programming
View GitHub Profile
Arpit0492 /
Last active May 14, 2020
Add equal spacing to RecyclerView items by specifying top, left, right & bottom margins. Can handle horizontal, vertical, and grid display modes
import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int topSpacing;
private final int leftSpacing;
private final int rightSpacing;