Skip to content

Instantly share code, notes, and snippets.

@andersonleite
Created June 18, 2015 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersonleite/f6aef12b21abc3a625ba to your computer and use it in GitHub Desktop.
Save andersonleite/f6aef12b21abc3a625ba to your computer and use it in GitHub Desktop.
/**
* Created by andersonl on 6/18/15.
*/
public class GridDecoration extends RecyclerView.ItemDecoration {
private int margin;
public GridDecoration(Context context) {
margin = context.getResources().getDimensionPixelSize(R.dimen.item_margin);
}
@Override
public void getItemOffsets(
Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.set(margin, margin, margin, margin);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment