Register now for Android Dev Summit 2019!

VerticalGridView

open class VerticalGridView : BaseGridView
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ androidx.recyclerview.widget.RecyclerView
   ↳ androidx.leanback.widget.BaseGridView
   ↳ androidx.leanback.widget.VerticalGridView

A android.view.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 constants

Public constructors

<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, attrs: AttributeSet!, defStyle: Int)

Public methods

open Unit

Sets the column width.

open Unit
setNumColumns(numColumns: Int)

Sets the number of columns.

Protected methods

open Unit
initAttributes(context: Context!, attrs: AttributeSet!)

Inherited functions

Public constructors

<init>

VerticalGridView(context: Context!)

<init>

VerticalGridView(context: Context!, attrs: AttributeSet!)

<init>

VerticalGridView(context: Context!, attrs: AttributeSet!, defStyle: Int)

Public methods

setColumnWidth

open fun setColumnWidth(width: Int): Unit

Sets the column width.

Parameters
width Int: May be android.view.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

open fun setNumColumns(numColumns: Int): Unit

Sets the number of columns. Defaults to one.

Protected methods

initAttributes

protected open fun initAttributes(context: Context!, attrs: AttributeSet!): Unit