public abstract class

GridItemDecoration

extends RecyclerView.ItemDecoration
java.lang.Object
   ↳ android.support.v7.widget.RecyclerView.ItemDecoration
     ↳ com.shinobicontrols.grids.supplement.GridItemDecoration
Known Direct Subclasses

Class Overview

Base class to provide decoration for items within the GridRecyclerViews contained within the ShinobiGridView.

An ItemDecoration allows the application to add a special drawing and layout offset to specific item views from the adapter's data set. This can be useful for drawing dividers between items, highlights, visual grouping boundaries and more.

Summary

Constants
int HORIZONTAL_LINES_ON_TOP

Constant for use with setGridlinesOnTop(int).

int VERTICAL_LINES_ON_TOP

Constant for use with setGridlinesOnTop(int).

Public Methods
int getGridlinesOnTop()

Returns the constant which dictates which lines are drawn on top.

int getHorizontalLineColor()

Returns the android.graphics.Color of the horizontal gridlines.

int getLineThickness()

Returns the thickness, in pixels, of the gridlines.

int getMargin()

Returns the space, in pixels, for each item's margin.

int getVerticalLineColor()

Returns the android.graphics.Color of the vertical gridlines.

void setGridlinesOnTop(int gridlinesOnTop)

Sets the constant which dictates which lines are drawn on top.

void setHorizontalLineColor(int horizontalLineColor)

Sets the android.graphics.Color of the horizontal gridlines.

void setLineThickness(int lineThickness)

Sets the thickness, in pixels, of the gridlines.

void setMargin(int margin)

Sets the space, in pixels, for each item's margin.

void setVerticalLineColor(int verticalLineColor)

Sets the android.graphics.Color of the vertical gridlines.

[Expand]
Inherited Methods
From class android.support.v7.widget.RecyclerView.ItemDecoration
From class java.lang.Object

Constants

public static final int HORIZONTAL_LINES_ON_TOP

Constant for use with setGridlinesOnTop(int). Indicates that horizontal gridlines will be drawn on top.

Constant Value: 2 (0x00000002)

public static final int VERTICAL_LINES_ON_TOP

Constant for use with setGridlinesOnTop(int). Indicates that vertical gridlines will be drawn on top.

Constant Value: 1 (0x00000001)

Public Methods

public int getGridlinesOnTop ()

Returns the constant which dictates which lines are drawn on top. By default this is set to HORIZONTAL_LINES_ON_TOP.

Returns
  • the constant which dictates which lines are drawn on top

public int getHorizontalLineColor ()

Returns the android.graphics.Color of the horizontal gridlines. By default this is set to DKGRAY.

Returns
  • the android.graphics.Color of the horizontal gridlines

public int getLineThickness ()

Returns the thickness, in pixels, of the gridlines. By default this is set to 0.

Returns
  • the thickness, in pixels, of the gridlines

public int getMargin ()

Returns the space, in pixels, for each item's margin. By default this is set to 0 which will leave no gap between the item's content and either the grid line, if available, or the next item.

The margin will not adopt the styling of the individual item, but rather that of the whole grid. If you wish to add spacing to the item and keep its style then you will need to use padding instead.

Returns
  • the space, in pixels, for each item's margin
See Also

public int getVerticalLineColor ()

Returns the android.graphics.Color of the vertical gridlines. By default this is set to DKGRAY.

Returns
  • the android.graphics.Color that the vertical line will be drawn with

public void setGridlinesOnTop (int gridlinesOnTop)

Sets the constant which dictates which lines are drawn on top. By default this is set to HORIZONTAL_LINES_ON_TOP.

The effects of this change will not be visible until invalidateItemDecorations() is called on the GridRecyclerView that this ItemDecoration belongs to.

Parameters
gridlinesOnTop the constant which dictates which lines are drawn on top

public void setHorizontalLineColor (int horizontalLineColor)

Sets the android.graphics.Color of the horizontal gridlines. By default this is set to DKGRAY.

The effects of this change will not be visible until invalidateItemDecorations() is called on the GridRecyclerView that this ItemDecoration belongs to.

Parameters
horizontalLineColor the android.graphics.Color that the horizontal line will be drawn with

public void setLineThickness (int lineThickness)

Sets the thickness, in pixels, of the gridlines. By default this is set to 0.

The effects of this change will not be visible until invalidateItemDecorations() is called on the GridRecyclerView that this ItemDecoration belongs to.

Parameters
lineThickness the thickness, in pixels, of the gridlines

public void setMargin (int margin)

Sets the space, in pixels, for each item's margin. By default this is set to 0 which will leave no gap between the item's content and either the grid line, if available, or the next item.

The margin won't adopt the styling of the individual item, but rather that of the whole grid. If you wish to add spacing to the item and keep its style then you will need to use padding instead.

The effects of this change will not be visible until invalidateItemDecorations() is called on the GridRecyclerView that this ItemDecoration belongs to.

Parameters
margin the space, in pixels, for each item's margin
See Also

public void setVerticalLineColor (int verticalLineColor)

Sets the android.graphics.Color of the vertical gridlines. By default this is set to DKGRAY.

The effects of this change will not be visible until invalidateItemDecorations() is called on the GridRecyclerView that this ItemDecoration belongs to.

Parameters
verticalLineColor the android.graphics.Color that the vertical line will be drawn with