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)

    Sets the selected row position with smooth animation.

    void setSelectedPosition(int position, boolean smooth)

    Sets the selected row position.

    Protected methods

    Object createEntranceTransition()

    Create entrance transition.

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

    This method was deprecated in API level 24.1.0. override onInflateTitleView(LayoutInflater, ViewGroup, Bundle) instead.

    void onEntranceTransitionEnd()

    Callback when entrance transition is ended.

    void onEntranceTransitionPrepare()

    Callback when entrance transition is prepared.

    void onEntranceTransitionStart()

    Callback when entrance transition is started.

    void onSetDetailsOverviewRowStatus(FullWidthDetailsOverviewRowPresenter presenter, FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int adapterPosition, int selectedPosition, int selectedSubPosition)

    Called to change DetailsOverviewRow view status when current selected row position or selected sub position changed.

    void onSetRowStatus(RowPresenter presenter, RowPresenter.ViewHolder viewHolder, int adapterPosition, int selectedPosition, int selectedSubPosition)

    Called on every visible row to change view status when current selected row position or selected sub position changed.

    void runEntranceTransition(Object entranceTransition)

    Run entrance transition.

    void setupDetailsOverviewRowPresenter(FullWidthDetailsOverviewRowPresenter presenter)

    Called to setup FullWidthDetailsOverviewRowPresenter.

    void setupPresenter(Presenter rowPresenter)

    Called to setup each Presenter of Adapter passed in setAdapter(ObjectAdapter).Note that setup should only change the Presenter behavior that is meaningful in DetailsSupportFragment.

    Inherited methods

    From class
    From class