Leanback

Write apps for Android TV devices using dpad-friendly widgets and template fragments.
Latest Update Stable Release Release Candidate Beta Release Alpha Release
November 15, 2023 1.0.0 1.1.0-rc02 - 1.2.0-alpha04

Declaring dependencies

To add a dependency on Leanback, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    def leanback_version = "1.2.0-alpha04"

    implementation "androidx.leanback:leanback:$leanback_version"

    // leanback-preference is an add-on that provides a settings UI for TV apps.
    implementation "androidx.leanback:leanback-preference:$leanback_version"

    // leanback-paging is an add-on that simplifies adding paging support to a RecyclerView Adapter.
    implementation "androidx.leanback:leanback-paging:1.1.0-alpha11"

    // leanback-tab is an add-on that provides customized TabLayout to be used as the top navigation bar.
    implementation "androidx.leanback:leanback-tab:1.1.0-beta01"
}

Kotlin

dependencies {
    val leanback_version = "1.2.0-alpha04"

    implementation("androidx.leanback:leanback:$leanback_version")

    // leanback-preference is an add-on that provides a settings UI for TV apps.
    implementation("androidx.leanback:leanback-preference:$leanback_version")

    // leanback-paging is an add-on that simplifies adding paging support to a RecyclerView Adapter.
    implementation("androidx.leanback:leanback-paging:1.1.0-alpha11")

    // leanback-tab is an add-on that provides customized TabLayout to be used as the top navigation bar.
    implementation("androidx.leanback:leanback-tab:1.1.0-beta01")
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Leanback-Grid Version 1.0.0

Version 1.0.0-alpha03

November 15, 2023

androidx.leanback:leanback-grid:1.0.0-alpha03 is released. Version 1.0.0-alpha03 contains these commits.

Dependency Updates

Version 1.0.0-alpha02

September 6, 2023

androidx.leanback:leanback-grid:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.

API Changes

  • Made setFocusOutAllowed public to allow the focus out properties to be set programmatically. (Iebd99)

Bug Fixes

  • Ensure grids are treated as grids by a11y services by setting an a11y node info class name. (I12812)
  • Add missing navigation sound when falling to smooth scroll. (f49767)

Version 1.0.0-alpha01

November 17, 2021

androidx.leanback:leanback-grid:1.0.0-alpha01 is released. Version 1.0.0-alpha01 contains these commits.

New Features

  • Moved following classes/interfaces from leanback to new leanback-grid library: BaseGridView, FacetProvider, FacetProviderAdapter, GridLayoutManager, HorizontalGridView, ItemAlignmentFacet, OnChildLaidOutListener, OnChildSelectedListener, OnChildViewHolderSelectedListener, VerticalGridView, ViewHolderTask, Visibility. This change preserves binary compatibility. Anyone willing to use just the grid view components of leanback can directly use leanback-grid as a dependency. (If1e49)

Leanback Leanback-Preference Version 1.2.0

Version 1.2.0-alpha04

November 15, 2023

androidx.leanback:leanback:1.2.0-alpha04 and androidx.leanback:leanback-preference:1.2.0-alpha04 are released. Version 1.2.0-alpha04 contains these commits.

Bug Fixes

Dependency Update

  • Update recyclerview requirement to 1.3.2 to fix a common crash in TV apps

Version 1.2.0-alpha03

September 6, 2023

androidx.leanback:leanback:1.2.0-alpha03 and androidx.leanback:leanback-preference:1.2.0-alpha03 are released. Version 1.2.0-alpha03 contains these commits.

API Changes

  • Added GuidedActionAppCompatEditText to better support the AppCompat theme. (ab7cf1, dc954d)

Version 1.2.0-alpha02

November 17, 2021

androidx.leanback:leanback:1.2.0-alpha02 and androidx.leanback:leanback-preference:1.2.0-alpha02 are released. Version 1.2.0-alpha02 contains these commits.

New Features

  • Moved following classes/interfaces from leanback to new leanback-grid library: BaseGridView, FacetProvider, FacetProviderAdapter, GridLayoutManager, HorizontalGridView, ItemAlignmentFacet, OnChildLaidOutListener, OnChildSelectedListener, OnChildViewHolderSelectedListener, VerticalGridView, ViewHolderTask, Visibility. This change preserves binary compatibility. Anyone willing to use just the grid view components of leanback can directly use leanback-grid as a dependency. (If1e49)

Version 1.2.0-alpha01

July 21, 2021

androidx.leanback:leanback:1.2.0-alpha01 and androidx.leanback:leanback-preference:1.2.0-alpha01 are released. Version 1.2.0-alpha01 contains these commits.

New Features

  • Made leanback GridLayoutManager public and exchangeable in BaseGridView. (f316b5)

API Changes

  • Made leanback GridLayoutManager public and exchangeable in BaseGridView. (f316b5)

Version 1.1.0

Leanback Version 1.1.0-rc02

July 21, 2021

androidx.leanback:leanback:1.1.0-rc02 is released. Version 1.1.0-rc02 contains these commits.

Bug Fixes

  • Fixed details fragment background bug. (40d8e3)

Leanback Leanback-Preference Version 1.1.0-rc01

April 7, 2021

androidx.leanback:leanback:1.1.0-rc01 and androidx.leanback:leanback-preference:1.1.0-rc01 are released. Version 1.1.0-rc01 contains these commits.

Leanback-Paging Version 1.1

Version 1.1.0-alpha11

November 15, 2023

androidx.leanback:leanback-paging:1.1.0-alpha11 is released with no changes. Version 1.1.0-alpha11 contains these commits.

Version 1.1.0-alpha10

September 6, 2023

androidx.leanback:leanback-paging:1.1.0-alpha10 is released. Version 1.1.0-alpha10 contains these commits.

New Features

  • Update leanback-paging to Paging 3.1.0. (882ed1)

Leanback-Paging Version 1.1.0-alpha09

November 17, 2021

androidx.leanback:leanback-paging:1.1.0-alpha09 is released. Version 1.1.0-alpha09 contains these commits.

Bug Fixes

  • Updated to use latest paging APIs.

Leanback-Paging Version 1.1.0-alpha08

July 21, 2021

androidx.leanback:leanback-paging:1.1.0-alpha08 is released. Version 1.1.0-alpha08 contains these commits.

API Changes

  • Added .peek() and .snapshot() APIs to PagingDataAdapter, allowing inspection of presented data without triggering page fetch. (Ic8917)

Leanback-Paging Version 1.1.0-alpha07

January 13, 2021

androidx.leanback:leanback-paging:1.1.0-alpha07 is released. Version 1.1.0-alpha07 contains these commits.

API Changes

  • Updated the convenience properties, CombinedLoadStates.refresh, CombinedLoadStates.prepend, CombinedLoadStates.append to only transition from Loading to NotLoading after both mediator and source load states are NotLoading to ensure the remote update has been applied. (I65619)

Leanback Leanback-Preference Leanback-Tab Version 1.1.0-beta01

December 2, 2020

androidx.leanback:leanback:1.1.0-beta01, androidx.leanback:leanback-preference:1.1.0-beta01, and androidx.leanback:leanback-tab:1.1.0-beta01 are released. Version 1.1.0-beta01 contains these commits.

Bug Fixes

  • Fix view leak when pushing VerticalGridSupportFragment to backstack (Iaac69, b/171909417)
  • Fix view leak when pushing BrowseSupportFragment to backstack (I34483, b/171909417)
  • Fix view leak when pushing DetailsSupportFragment to backstack (Ifec9e, b/171909417)
  • Fix view leak when pushing RowsSupportFragment to backstack (I985d4, b/171909417)
  • Fix GuidedStepSupportFragment background transition animation. (I86d15, b/173647688)
  • Fix IllegalArgumentException when restoring GuidedStepSupportFragment (Ic829f, b/172000115)
  • Fix GridLayoutManager NullPointerException in findContainingItemView() when clearFocus() (Id0e42)

Leanback-Paging Version 1.1.0-alpha06

December 2, 2020

androidx.leanback:leanback-paging:1.1.0-alpha06 is released. Version 1.1.0-alpha06 contains these commits.

API Changes

  • dataRefreshFlow / dataRefreshListener APIs have been removed as they are redundant with loadStateFlow / Listener updates. For those migrating, the loadStateFlow equivalent is:

    loadStateFlow.distinctUntilChangedBy { it.refresh }
        .filter { it.refresh is NotLoading }
    

    (Ib5570, b/173530908)

  • Full deprecate dataRefreshFlow / Listener methods with a replaceWith clause. (I6e2dd)

Version 1.1.0-alpha05

October 1, 2020

androidx.leanback:leanback-*:1.1.0-alpha05 is released. Version 1.1.0-alpha05 contains these commits.

New Features

  • Let A11Y navigation respect GridLayoutManager focusOutFront and focusOutEnd attributes. (b/161390258)

Bug Fixes

  • Fix View leak in GuidanceStylist.onDestroyView() (b/164841457)
  • Fix ConcatAdapter in GridLayoutManager (b/165694295)
  • leanback-tab: Javadoc improvements and minor code refactoring (aosp/1393383)
  • Remove setRecyclerView method from API which was added when same method was deprecated on RecyclerView. Update leanback lib to use RecyclerView's new addRecyclerListener API method. (I14798)

Version 1.1.0-alpha04

August 11, 2020

androidx.leanback:leanback:1.1.0-alpha04, androidx.leanback:leanback-paging:1.1.0-alpha04, androidx.leanback:leanback-preference:1.1.0-alpha04, and androidx.leanback:leanback-tab:1.1.0-alpha04 are released. Version 1.1.0-alpha04 contains these commits.

New Features

  • The LeanbackTabLayout provides the top navigation (typically displayed horizontally across the top of the app) in the browse experience.
  • Paging for Leanback simplifies adding paging support to a RecyclerView.Adapter.
  • Added appcompat themes for leanback that will simplify the creation of a single code base between mobile and TV.

API Changes

  • Added adapter based on asyncpagingdatadiffer for leanback widgets (If0dfe)
  • Adding a customized TabLayout to be used as the top navigation bar in leanback (I1e304)

Version 1.1.0-alpha03

December 18, 2019

androidx.leanback:leanback:1.1.0-alpha03 and androidx.leanback:leanback-preference:1.1.0-alpha03 are released. Leanback Version 1.1.0-alpha03 contains these commits and Leanback-Preference Version 1.1.0-alpha03 contains these commits.

New features

  • BaseGridView now supports custom scrolling speeds (aosp/952718)
  • Made guided step item touch more friendly (aosp/1167964)
  • Exposed the BaseGridView OnLayoutCompleteListener so apps can perform View transformations after the layout pass. (aosp/1164409)

API changes

  • Added a new API to allow custom BaseGridView scrolling speeds (aosp/952718)
  • Added a new API to add OnLayoutCompleteListener in BaseGridView (aosp/1164409)

Bug fixes

  • Fixed a bug where fast layout pass doesn’t update the alignment of a child. (aosp/1122745)
  • Fixed a stack overflow crash in the Picker widget when the focus is changing (aosp/1168473)

Dependency changes

  • Leanback-preference: pinned the dependency of androidx.preference to 1.1.0 (aosp/1181902)

Version 1.1.0-alpha02

May 7, 2019

androidx.leanback:leanback:1.1.0-alpha02 and androidx.leanback:leanback-preference:1.1.0-alpha02 are released. The commits included in this version can at leanback commits and leanback-preference commits.

New features

  • RowsSupportFragment is now allowed to share ViewHolders with other RowsSupportFragments, which would improve performance for a multiple-tab UI.

API changes

  • Added PlaybackSupportFragment.setShowOrHideControlsOverlayOnUserInteraction() to allow app disable auto hide/show playback controls when DPAD is pressed.

Bug fixes

  • Fixed broken leanback-preference Fragments theme due to a change in preference library.
  • Fix navigation bug when BACK key is pressed on SearchEditText

Version 1.1.0-alpha01

January 30, 2019

androidx.leanback:leanback 1.1.0-alpha01 is released.

New features

  • Added PinPicker widget.
  • Outline clipping is now disabled by default on low-ram device.
  • Allowed customized PlaybackSupportFragment showing/hiding controls behavior (b/122918400)

API changes

  • Framework fragments were deprecated.
  • New PinPicker class.

Bug fixes

  • Fixed a fragment transaction crash after BrowseSupportFragment is stopped
  • GuidedStepSupportFragment should not clip items in VerticalGridView (aosp/787396)
  • onCreateActionsStylist() and onCreateGuidanceStylist() were moved from constructor to GuidedSupportFragment.onCreate() (aosp/787397)
  • Fixed a bug where SearchSupportFragment failed to focus to results fragment. (aosp/798833)
  • Fixed a scrolling bug in VerticalGridView and HorizontalGridView (aosp/858809)

androidx.leanback-preference 1.1.0-alpha01 is released.

New features

  • Added androidx fragment classes, deprecated framework fragment classes.
  • Colors and fonts are now based on framework theme attributes.

API changes

  • New androidx fragment classes, framework fragment classes were deprecated.