Skip to content

Most visited

Recently visited

navigation
added in version 22.1.0
belongs to Maven artifact com.android.support:leanback-v17:27.0.0

HeadersFragment

public class HeadersFragment
extends Fragment

java.lang.Object
   ↳ android.app.Fragment
     ↳ android.support.v17.leanback.app.HeadersFragment


An fragment containing a list of row headers. Implementation must support three types of rows:

Use setPresenterSelector(PresenterSelector) in subclass constructor to customize Presenters. App may override onCreateHeadersFragment().

Summary

Nested classes

interface HeadersFragment.OnHeaderClickedListener

Interface definition for a callback to be invoked when a header item is clicked. 

interface HeadersFragment.OnHeaderViewSelectedListener

Interface definition for a callback to be invoked when a header item is selected. 

Inherited constants

From interface android.content.ComponentCallbacks2

Public constructors

HeadersFragment()

Public methods

final ObjectAdapter getAdapter()

Returns the Adapter that represents list of rows.

final ItemBridgeAdapter getBridgeAdapter()

Returns the RecyclerView.Adapter that wraps getAdapter().

final PresenterSelector getPresenterSelector()

Get the presenter selector used to create and bind views.

int getSelectedPosition()

Gets position of currently selected row.

final VerticalGridView getVerticalGridView()
boolean isScrolling()
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
void onDestroyView()
void onSaveInstanceState(Bundle outState)
void onTransitionEnd()
boolean onTransitionPrepare()
void onTransitionStart()
void onViewCreated(View view, Bundle savedInstanceState)
final void setAdapter(ObjectAdapter rowsAdapter)

Sets the adapter that represents a list of rows.

void setAlignment(int windowAlignOffsetTop)
void setOnHeaderClickedListener(HeadersFragment.OnHeaderClickedListener listener)
void setOnHeaderViewSelectedListener(HeadersFragment.OnHeaderViewSelectedListener listener)
final void setPresenterSelector(PresenterSelector presenterSelector)

Set the presenter selector used to create and bind views.

void setSelectedPosition(int position)

Sets the selected row position with smooth animation.

void setSelectedPosition(int position, boolean smooth)

Sets the selected row position.

Inherited methods

From class android.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener
From interface android.content.ComponentCallbacks

Public constructors

HeadersFragment

added in version 22.1.0
HeadersFragment ()

Public methods

getAdapter

added in version 22.1.0
ObjectAdapter getAdapter ()

Returns the Adapter that represents list of rows.

Returns
ObjectAdapter Adapter that represents list of rows.

getBridgeAdapter

added in version 26.1.0
ItemBridgeAdapter getBridgeAdapter ()

Returns the RecyclerView.Adapter that wraps getAdapter().

Returns
ItemBridgeAdapter The RecyclerView.Adapter that wraps getAdapter().

getPresenterSelector

added in version 22.1.0
PresenterSelector getPresenterSelector ()

Get the presenter selector used to create and bind views.

Returns
PresenterSelector

getSelectedPosition

added in version 24.1.0
int getSelectedPosition ()

Gets position of currently selected row.

Returns
int Position of currently selected row.

getVerticalGridView

added in version 25.1.0
VerticalGridView getVerticalGridView ()

Returns
VerticalGridView

isScrolling

added in version 24.1.0
boolean isScrolling ()

Returns
boolean

onCreateView

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

Parameters
inflater LayoutInflater

container ViewGroup

savedInstanceState Bundle

Returns
View

onDestroyView

void onDestroyView ()

onSaveInstanceState

void onSaveInstanceState (Bundle outState)

Parameters
outState Bundle

onTransitionEnd

added in version 24.1.0
void onTransitionEnd ()

onTransitionPrepare

added in version 24.1.0
boolean onTransitionPrepare ()

Returns
boolean

onTransitionStart

added in version 24.1.0
void onTransitionStart ()

onViewCreated

void onViewCreated (View view, 
                Bundle savedInstanceState)

Parameters
view View

savedInstanceState Bundle

setAdapter

added in version 22.1.0
void setAdapter (ObjectAdapter rowsAdapter)

Sets the adapter that represents a list of rows.

Parameters
rowsAdapter ObjectAdapter: Adapter that represents list of rows.

setAlignment

added in version 24.1.0
void setAlignment (int windowAlignOffsetTop)

Parameters
windowAlignOffsetTop int

setOnHeaderClickedListener

added in version 22.1.0
void setOnHeaderClickedListener (HeadersFragment.OnHeaderClickedListener listener)

Parameters
listener HeadersFragment.OnHeaderClickedListener

setOnHeaderViewSelectedListener

added in version 22.1.0
void setOnHeaderViewSelectedListener (HeadersFragment.OnHeaderViewSelectedListener listener)

Parameters
listener HeadersFragment.OnHeaderViewSelectedListener

setPresenterSelector

added in version 22.1.0
void setPresenterSelector (PresenterSelector presenterSelector)

Set the presenter selector used to create and bind views.

Parameters
presenterSelector PresenterSelector

setSelectedPosition

added in version 22.1.0
void setSelectedPosition (int position)

Sets the selected row position with smooth animation.

Parameters
position int

setSelectedPosition

added in version 22.1.0
void setSelectedPosition (int position, 
                boolean smooth)

Sets the selected row position.

Parameters
position int

smooth boolean

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)