added in version 22.1.0
belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1

HorizontalGridView

public class HorizontalGridView
extends BaseGridView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.v7.widget.RecyclerView
         ↳ android.support.v17.leanback.widget.BaseGridView
           ↳ android.support.v17.leanback.widget.HorizontalGridView


A ViewGroup that shows items in a horizontal scrolling list. The items come from the RecyclerView.Adapter associated with this view.

RecyclerView.Adapter can optionally implement FacetProviderAdapter which provides FacetProvider for a given view type; RecyclerView.ViewHolder can also implement FacetProvider. Facet from ViewHolder has a higher priority than the one from FacetProviderAdapter associated with viewType. Supported optional facets are:

  1. ItemAlignmentFacet When this facet is provided by ViewHolder or FacetProviderAdapter, it will override the item alignment settings set on HorizontalGridView. This facet also allows multiple alignment positions within one ViewHolder.

Summary

Inherited XML attributes

From class android.support.v7.widget.RecyclerView

Inherited constants

From class android.support.v17.leanback.widget.BaseGridView
From class android.support.v7.widget.RecyclerView
From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

HorizontalGridView(Context context)
HorizontalGridView(Context context, AttributeSet attrs)
HorizontalGridView(Context context, AttributeSet attrs, int defStyle)

Public methods

void draw(Canvas canvas)
final boolean getFadingLeftEdge()

Returns true if left edge fading is enabled.

final int getFadingLeftEdgeLength()

Returns the left edge fading length in pixels.

final int getFadingLeftEdgeOffset()

Returns the distance in pixels between fading start position and left padding edge.

final boolean getFadingRightEdge()

Returns true if fading right edge is enabled.

final int getFadingRightEdgeLength()

Returns the right edge fading length in pixels.

final int getFadingRightEdgeOffset()

Sets the distance in pixels between fading start position and right padding edge.

final void setFadingLeftEdge(boolean fading)

Sets the fade out left edge to transparent.

final void setFadingLeftEdgeLength(int fadeLength)

Sets the left edge fading length in pixels.

final void setFadingLeftEdgeOffset(int fadeOffset)

Sets the distance in pixels between fading start position and left padding edge.

final void setFadingRightEdge(boolean fading)

Sets the fade out right edge to transparent.

final void setFadingRightEdgeLength(int fadeLength)

Sets the right edge fading length in pixels.

final void setFadingRightEdgeOffset(int fadeOffset)

Returns the distance in pixels between fading start position and right padding edge.

void setNumRows(int numRows)

Sets the number of rows.

void setRowHeight(int height)

Sets the row height.

Protected methods

void initAttributes(Context context, AttributeSet attrs)

Inherited methods

From class android.support.v17.leanback.widget.BaseGridView
From class android.support.v7.widget.RecyclerView
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.support.v4.view.ScrollingView
From interface android.support.v4.view.NestedScrollingChild2
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource
From interface android.support.v4.view.NestedScrollingChild

Public constructors

HorizontalGridView

added in version 22.1.0
HorizontalGridView (Context context)

Parameters
context Context

HorizontalGridView

added in version 22.1.0
HorizontalGridView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

HorizontalGridView

added in version 22.1.0
HorizontalGridView (Context context, 
                AttributeSet attrs, 
                int defStyle)

Parameters
context Context

attrs AttributeSet

defStyle int

Public methods

draw

void draw (Canvas canvas)

Parameters
canvas Canvas

getFadingLeftEdge

added in version 22.1.0
boolean getFadingLeftEdge ()

Returns true if left edge fading is enabled.

Returns
boolean

getFadingLeftEdgeLength

added in version 22.1.0
int getFadingLeftEdgeLength ()

Returns the left edge fading length in pixels.

Returns
int

getFadingLeftEdgeOffset

added in version 22.1.0
int getFadingLeftEdgeOffset ()

Returns the distance in pixels between fading start position and left padding edge. The fading start position is positive when start position is inside left padding area. Default value is 0, means that the fading starts from left padding edge.

Returns
int

getFadingRightEdge

added in version 22.1.0
boolean getFadingRightEdge ()

Returns true if fading right edge is enabled.

Returns
boolean

getFadingRightEdgeLength

added in version 22.1.0
int getFadingRightEdgeLength ()

Returns the right edge fading length in pixels.

Returns
int

getFadingRightEdgeOffset

added in version 22.1.0
int getFadingRightEdgeOffset ()

Sets the distance in pixels between fading start position and right padding edge. The fading start position is positive when start position is inside right padding area. Default value is 0, means that the fading starts from right padding edge.

Returns
int

setFadingLeftEdge

added in version 22.1.0
void setFadingLeftEdge (boolean fading)

Sets the fade out left edge to transparent. Note turn on fading edge is very expensive that you should turn off when HorizontalGridView is scrolling.

Parameters
fading boolean

setFadingLeftEdgeLength

added in version 22.1.0
void setFadingLeftEdgeLength (int fadeLength)

Sets the left edge fading length in pixels.

Parameters
fadeLength int

setFadingLeftEdgeOffset

added in version 22.1.0
void setFadingLeftEdgeOffset (int fadeOffset)

Sets the distance in pixels between fading start position and left padding edge. The fading start position is positive when start position is inside left padding area. Default value is 0, means that the fading starts from left padding edge.

Parameters
fadeOffset int

setFadingRightEdge

added in version 22.1.0
void setFadingRightEdge (boolean fading)

Sets the fade out right edge to transparent. Note turn on fading edge is very expensive that you should turn off when HorizontalGridView is scrolling.

Parameters
fading boolean

setFadingRightEdgeLength

added in version 22.1.0
void setFadingRightEdgeLength (int fadeLength)

Sets the right edge fading length in pixels.

Parameters
fadeLength int

setFadingRightEdgeOffset

added in version 22.1.0
void setFadingRightEdgeOffset (int fadeOffset)

Returns the distance in pixels between fading start position and right padding edge. The fading start position is positive when start position is inside right padding area. Default value is 0, means that the fading starts from right padding edge.

Parameters
fadeOffset int

setNumRows

added in version 22.1.0
void setNumRows (int numRows)

Sets the number of rows. Defaults to one.

Parameters
numRows int

setRowHeight

added in version 22.1.0
void setRowHeight (int height)

Sets the row height.

Parameters
height int: May be WRAP_CONTENT, or a size in pixels. If zero, row height will be fixed based on number of rows and view height.

Protected methods

initAttributes

added in version 22.1.0
void initAttributes (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet