Join us on the livestream at Android Dev Summit on 7-8 November 2018, starting at 10AM PDT!
added in version 1.0.0
belongs to Maven artifact androidx.leanback:leanback:1.0.0

VerticalGridView

public class VerticalGridView
extends BaseGridView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.recyclerview.widget.RecyclerView
         ↳ androidx.leanback.widget.BaseGridView
           ↳ androidx.leanback.widget.VerticalGridView


A ViewGroup that shows items in a vertically 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 VerticalGridView. This facet also allows multiple alignment positions within one ViewHolder.

Summary

Inherited XML attributes

Inherited constants

Inherited fields

Public constructors

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

Public methods

void setColumnWidth(int width)

Sets the column width.

void setNumColumns(int numColumns)

Sets the number of columns.

Protected methods

void initAttributes(Context context, AttributeSet attrs)

Inherited methods

Public constructors

VerticalGridView

added in version 1.0.0
public VerticalGridView (Context context)

Parameters
context Context

VerticalGridView

added in version 1.0.0
public VerticalGridView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

VerticalGridView

added in version 1.0.0
public VerticalGridView (Context context, 
                AttributeSet attrs, 
                int defStyle)

Parameters
context Context

attrs AttributeSet

defStyle int

Public methods

setColumnWidth

added in version 1.0.0
public void setColumnWidth (int width)

Sets the column width.

Parameters
width int: May be ViewGroup.LayoutParams.WRAP_CONTENT, or a size in pixels. If zero, column width will be fixed based on number of columns and view width.

setNumColumns

added in version 1.0.0
public void setNumColumns (int numColumns)

Sets the number of columns. Defaults to one.

Parameters
numColumns int

Protected methods

initAttributes

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

Parameters
context Context

attrs AttributeSet