Skip to content

Instantly share code, notes, and snippets.

View ananth10's full-sized avatar
🎯
Focusing

ananth ananth10

🎯
Focusing
View GitHub Profile
@ananth10
ananth10 / gist:f9f66d8c58547b534093d951acd5f6cd
Created June 30, 2017 13:48 — forked from yqritc/gist:ccca77dc42f2364777e1
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@ananth10
ananth10 / GridDividerDecoration.java
Created August 10, 2017 12:47
Item decoration for RecyclerViews with GridLayoutManagers.
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class GridDividerDecoration extends RecyclerView.ItemDecoration {
private int space;
private int spanCount;
private int lastItemInFirstLane = -1;