added in version 22.1.0
belongs to Maven artifact


public class DetailsSupportFragment
extends BaseSupportFragment


A fragment for creating Leanback details screens.

A DetailsSupportFragment renders the elements of its ObjectAdapter as a set of rows in a vertical list.The Adapter's PresenterSelector must maintain subclasses of RowPresenter.

When FullWidthDetailsOverviewRowPresenter is found in adapter, DetailsSupportFragment will setup default behavior of the DetailsOverviewRow:
  • The alignment of FullWidthDetailsOverviewRowPresenter is setup in setupDetailsOverviewRowPresenter(FullWidthDetailsOverviewRowPresenter).
  • The view status switching of FullWidthDetailsOverviewRowPresenter is done in onSetDetailsOverviewRowStatus(FullWidthDetailsOverviewRowPresenter, FullWidthDetailsOverviewRowPresenter.ViewHolder, int, int, int).
  • The recommended activity themes to use with a DetailsSupportFragment are

  • Theme_Leanback_Details with activity shared element transition for FullWidthDetailsOverviewRowPresenter.
  • Theme_Leanback_Details_NoSharedElementTransition if shared element transition is not needed, for example if first row is not rendered by FullWidthDetailsOverviewRowPresenter.
  • DetailsSupportFragment can use DetailsSupportFragmentBackgroundController to add a parallax drawable background and embedded video playing fragment.


    Public constructors


    Public methods

    ObjectAdapter getAdapter()

    Returns the list of rows.

    BaseOnItemViewClickedListener getOnItemViewClickedListener()

    Returns the item clicked listener.

    DetailsParallax getParallax()

    Returns the DetailsParallax instance used by DetailsSupportFragmentBackgroundController to configure parallax effect of background and control embedded video playback.

    RowsSupportFragment getRowsSupportFragment()

    Gets embedded RowsSupportFragment showing multiple rows for DetailsSupportFragment.

    void onCreate(Bundle savedInstanceState)

    Called to do initial creation of a fragment.

    View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

    Called to have the fragment instantiate its user interface view.

    View onInflateTitleView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)

    Called by installTitleView(LayoutInflater, ViewGroup, Bundle) to inflate title view.

    void onStart()

    Called when the Fragment is visible to the user.

    void onStop()

    Called when the Fragment is no longer started.

    void setAdapter(ObjectAdapter adapter)

    Sets the list of rows for the fragment.

    void setOnItemViewClickedListener(BaseOnItemViewClickedListener listener)

    Sets an item clicked listener.

    void setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener)

    Sets an item selection listener.

    void setSelectedPosition(int position)