package

androidx.leanback

Overview

Support classes for building Leanback user experiences.

Many apps intended for a 10-foot, or 'Leanback', experience are centered around media and games. Games tend to have custom user interfaces, but media applications may benefit from a common set of user interface components that work well in a Leanback environment. Following is an overview of the Leanback Support Library.

Leanback provides a model-view-presenter approach to building applications:

  • The model is primarily provided by the application developer. Leanback imposes very few restrictions on how this model is implemented: anything extending Object in Java is supported.
  • The view is handled by the existing android.view package. Developers may continue to use their existing knowledge and experience to create visually compelling applications with Leanback.
  • The presenter is based on the existing Adapter concept in the Android framework, but has been updated to add more flexibility and composability. In particular, the interface for binding data to views has been separated from the adapter that traverses the data, allowing presenters to be used in more places. See Presenter for more details.

Leanback contains a mixture of higher level building blocks such as Fragments in the androidx.leanback.app package. Notable examples are the BrowseSupportFragment, DetailsSupportFragment, PlaybackSupportFragment and the GuidedStepSupportFragment. Helper classes are also provided that work with the leanback fragments, for example the PlaybackTransportControlGlue and PlaybackSupportFragmentGlueHost.