Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

ViewHolder

open class ViewHolder : FacetProvider
kotlin.Any
   ↳ androidx.leanback.widget.Presenter.ViewHolder

ViewHolder can be subclassed and used to cache any view accessors needed to improve binding performance (for example, results of findViewById) without needing to subclass a View.

Summary

Public constructors

<init>(view: View!)

Public methods

Any!
getFacet(facetClass: Class<*>!)

Unit
setFacet(facetClass: Class<*>!, facetImpl: Any!)

Sets dynamic implemented facet in addition to basic ViewHolder functions.

Properties

View!

Public constructors

<init>

ViewHolder(view: View!)

Public methods

getFacet

fun getFacet(facetClass: Class<*>!): Any!

setFacet

fun setFacet(facetClass: Class<*>!, facetImpl: Any!): Unit

Sets dynamic implemented facet in addition to basic ViewHolder functions.

Parameters
facetClass Class<*>!: Facet classes to query, can be class of ItemAlignmentFacet.
facetImpl Class<*>!: Facet implementation.

Properties

view

val view: View!