belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
RowsSupportFragment
public
class
RowsSupportFragment
extends Fragment
implements
BrowseSupportFragment.MainFragmentRowsAdapterProvider,
BrowseSupportFragment.MainFragmentAdapterProvider
java.lang.Object | ||
↳ | android.support.v4.app.Fragment | |
↳ | android.support.v17.leanback.app.RowsSupportFragment |
An ordered set of rows of leanback widgets.
A RowsSupportFragment renders the elements of its
ObjectAdapter
as a set
of rows in a vertical list. The Adapter's PresenterSelector
must maintain subclasses
of RowPresenter
.
Summary
Nested classes | |
---|---|
class |
RowsSupportFragment.MainFragmentAdapter
|
class |
RowsSupportFragment.MainFragmentRowsAdapter
The adapter that RowsSupportFragment implements BrowseSupportFragment.MainFragmentRowsAdapter. |
Public constructors | |
---|---|
RowsSupportFragment()
|
Public methods | |
---|---|
void
|
enableRowScaling(boolean enable)
This method was deprecated
in API level 24.1.0.
use |
RowPresenter.ViewHolder
|
findRowViewHolderByPosition(int position)
Find row ViewHolder by position in adapter. |
final
ObjectAdapter
|
getAdapter()
Returns the Adapter that represents list of rows. |
final
ItemBridgeAdapter
|
getBridgeAdapter()
Returns the RecyclerView.Adapter that wraps |
MainFragmentAdapter
|
getMainFragmentAdapter()
Returns an instance of |
MainFragmentRowsAdapter
|
getMainFragmentRowsAdapter()
Returns an instance of |
BaseOnItemViewClickedListener
|
getOnItemViewClickedListener()
Returns the item clicked listener. |
BaseOnItemViewSelectedListener
|
getOnItemViewSelectedListener()
Returns an item selection listener. |
final
PresenterSelector
|
getPresenterSelector()
Get the presenter selector used to create and bind views. |
RowPresenter.ViewHolder
|
getRowViewHolder(int position)
Get row ViewHolder at adapter position. |
int
|
getSelectedPosition()
Gets position of currently selected row. |
final
VerticalGridView
|
getVerticalGridView()
|
boolean
|
isScrolling()
|
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. |
void
|
onDestroyView()
Called when the view previously created by |
void
|
onSaveInstanceState(Bundle outState)
Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted. |
void
|
onTransitionEnd()
|
boolean
|
onTransitionPrepare()
|
void
|
onTransitionStart()
|
void
|
onViewCreated(View view, Bundle savedInstanceState)
Called immediately after |
final
void
|
setAdapter(ObjectAdapter rowsAdapter)
Sets the adapter that represents a list of rows. |
void
|
setAlignment(int windowAlignOffsetFromTop)
|
void
|
setEntranceTransitionState(boolean afterTransition)
For rows that willing to participate entrance transition, this function hide views if afterTransition is true, show views if afterTransition is false. |
void
|
setExpand(boolean expand)
Set the visibility of titles/hovercard of browse rows. |
void
|
setOnItemViewClickedListener(BaseOnItemViewClickedListener listener)
Sets an item clicked listener on the fragment. |
void
|
setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener)
Sets an item selection 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 rowPosition, boolean smooth, Presenter.ViewHolderTask rowHolderTask)
Selects a Row and perform an optional task on the Row. |
void
|
setSelectedPosition(int position, boolean smooth)
Sets the selected row position. |
Protected methods | |
---|---|
VerticalGridView
|
findGridViewFromRoot(View view)
|
Inherited methods | |
---|---|
From
class
android.support.v4.app.Fragment
| |
From
class
java.lang.Object
| |
From
interface
android.content.ComponentCallbacks
| |
From
interface
android.view.View.OnCreateContextMenuListener
| |
From
interface
android.arch.lifecycle.LifecycleOwner
| |
From
interface
android.arch.lifecycle.ViewModelStoreOwner
| |
From
interface
android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentRowsAdapterProvider
| |
From
interface
android.support.v17.leanback.app.BrowseSupportFragment.MainFragmentAdapterProvider
|
Public constructors
Public methods
enableRowScaling
void enableRowScaling (boolean enable)
This method was deprecated
in API level 24.1.0.
use enableRowScaling(boolean)
instead.
Parameters | |
---|---|
enable |
boolean : true to enable row scaling
|
findRowViewHolderByPosition
RowPresenter.ViewHolder findRowViewHolderByPosition (int position)
Find row ViewHolder by position in adapter.
Parameters | |
---|---|
position |
int : Position of row. |
Returns | |
---|---|
RowPresenter.ViewHolder |
ViewHolder of Row. |
getAdapter
ObjectAdapter getAdapter ()
Returns the Adapter that represents list of rows.
Returns | |
---|---|
ObjectAdapter |
Adapter that represents list of rows. |
getBridgeAdapter
ItemBridgeAdapter getBridgeAdapter ()
Returns the RecyclerView.Adapter that wraps getAdapter()
.
Returns | |
---|---|
ItemBridgeAdapter |
The RecyclerView.Adapter that wraps getAdapter() .
|
getMainFragmentAdapter
MainFragmentAdapter getMainFragmentAdapter ()
Returns an instance of BrowseSupportFragment.MainFragmentAdapter
that BrowseSupportFragment
would use to communicate with the target fragment.
Returns | |
---|---|
MainFragmentAdapter |
getMainFragmentRowsAdapter
MainFragmentRowsAdapter getMainFragmentRowsAdapter ()
Returns an instance of BrowseSupportFragment.MainFragmentRowsAdapter
that BrowseSupportFragment
would use to communicate with the target fragment.
Returns | |
---|---|
MainFragmentRowsAdapter |
getOnItemViewClickedListener
BaseOnItemViewClickedListener getOnItemViewClickedListener ()
Returns the item clicked listener.
Returns | |
---|---|
BaseOnItemViewClickedListener |
getOnItemViewSelectedListener
BaseOnItemViewSelectedListener getOnItemViewSelectedListener ()
Returns an item selection listener.
Returns | |
---|---|
BaseOnItemViewSelectedListener |
getPresenterSelector
PresenterSelector getPresenterSelector ()
Get the presenter selector used to create and bind views.
Returns | |
---|---|
PresenterSelector |
getRowViewHolder
RowPresenter.ViewHolder getRowViewHolder (int position)
Get row ViewHolder at adapter position. Returns null if the row object is not in adapter or the row object has not been bound to a row view.
Parameters | |
---|---|
position |
int : Position of row in adapter. |
Returns | |
---|---|
RowPresenter.ViewHolder |
Row ViewHolder at a given adapter position. |
getSelectedPosition
int getSelectedPosition ()
Gets position of currently selected row.
Returns | |
---|---|
int |
Position of currently selected row. |
getVerticalGridView
VerticalGridView getVerticalGridView ()
Returns | |
---|---|
VerticalGridView |
onCreate
void onCreate (Bundle savedInstanceState)
Called to do initial creation of a fragment. This is called after
onAttach(Activity)
and before
onCreateView(LayoutInflater, ViewGroup, Bundle)
.
Note that this can be called while the fragment's activity is
still in the process of being created. As such, you can not rely
on things like the activity's content view hierarchy being initialized
at this point. If you want to do work once the activity itself is
created, see onActivityCreated(Bundle)
.
Any restored child fragments will be created before the base
Fragment.onCreate
method returns.
Parameters | |
---|---|
savedInstanceState |
Bundle : If the fragment is being re-created from
a previous saved state, this is the state.
|
onCreateView
View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Called to have the fragment instantiate its user interface view.
This is optional, and non-graphical fragments can return null (which
is the default implementation). This will be called between
onCreate(Bundle)
and onActivityCreated(Bundle)
.
If you return a View from here, you will later be called in
onDestroyView()
when the view is being released.
Parameters | |
---|---|
inflater |
LayoutInflater : The LayoutInflater object that can be used to inflate
any views in the fragment, |
container |
ViewGroup : If non-null, this is the parent view that the fragment's
UI should be attached to. The fragment should not add the view itself,
but this can be used to generate the LayoutParams of the view. |
savedInstanceState |
Bundle : If non-null, this fragment is being re-constructed
from a previous saved state as given here. |
Returns | |
---|---|
View |
Return the View for the fragment's UI, or null. |
onDestroyView
void onDestroyView ()
Called when the view previously created by onCreateView(LayoutInflater, ViewGroup, Bundle)
has
been detached from the fragment. The next time the fragment needs
to be displayed, a new view will be created. This is called
after onStop()
and before onDestroy()
. It is called
regardless of whether onCreateView(LayoutInflater, ViewGroup, Bundle)
returned a
non-null view. Internally it is called after the view's state has
been saved but before it has been removed from its parent.
onSaveInstanceState
void onSaveInstanceState (Bundle outState)
Called to ask the fragment to save its current dynamic state, so it
can later be reconstructed in a new instance of its process is
restarted. If a new instance of the fragment later needs to be
created, the data you place in the Bundle here will be available
in the Bundle given to onCreate(Bundle)
,
onCreateView(LayoutInflater, ViewGroup, Bundle)
, and
onActivityCreated(Bundle)
.
This corresponds to Activity.onSaveInstanceState(Bundle)
and most of the discussion there
applies here as well. Note however: this method may be called
at any time before onDestroy()
. There are many situations
where a fragment may be mostly torn down (such as when placed on the
back stack with no UI showing), but its state will not be saved until
its owning activity actually needs to save its state.
Parameters | |
---|---|
outState |
Bundle : Bundle in which to place your saved state.
|
onViewCreated
void onViewCreated (View view, Bundle savedInstanceState)
Called immediately after onCreateView(LayoutInflater, ViewGroup, Bundle)
has returned, but before any saved state has been restored in to the view.
This gives subclasses a chance to initialize themselves once
they know their view hierarchy has been completely created. The fragment's
view hierarchy is not however attached to its parent at this point.
Parameters | |
---|---|
view |
View : The View returned by onCreateView(LayoutInflater, ViewGroup, Bundle) . |
savedInstanceState |
Bundle : If non-null, this fragment is being re-constructed
from a previous saved state as given here.
|
setAdapter
void setAdapter (ObjectAdapter rowsAdapter)
Sets the adapter that represents a list of rows.
Parameters | |
---|---|
rowsAdapter |
ObjectAdapter : Adapter that represents list of rows.
|
setAlignment
void setAlignment (int windowAlignOffsetFromTop)
Parameters | |
---|---|
windowAlignOffsetFromTop |
int |
setEntranceTransitionState
void setEntranceTransitionState (boolean afterTransition)
For rows that willing to participate entrance transition, this function hide views if afterTransition is true, show views if afterTransition is false.
Parameters | |
---|---|
afterTransition |
boolean |
setExpand
void setExpand (boolean expand)
Set the visibility of titles/hovercard of browse rows.
Parameters | |
---|---|
expand |
boolean |
setOnItemViewClickedListener
void setOnItemViewClickedListener (BaseOnItemViewClickedListener listener)
Sets an item clicked listener on the fragment.
OnItemViewClickedListener will override View.OnClickListener
that
item presenter sets during onCreateViewHolder(ViewGroup)
.
So in general, developer should choose one of the listeners but not both.
Parameters | |
---|---|
listener |
BaseOnItemViewClickedListener |
setOnItemViewSelectedListener
void setOnItemViewSelectedListener (BaseOnItemViewSelectedListener listener)
Sets an item selection listener.
Parameters | |
---|---|
listener |
BaseOnItemViewSelectedListener |
setPresenterSelector
void setPresenterSelector (PresenterSelector presenterSelector)
Set the presenter selector used to create and bind views.
Parameters | |
---|---|
presenterSelector |
PresenterSelector |
setSelectedPosition
void setSelectedPosition (int position)
Sets the selected row position with smooth animation.
Parameters | |
---|---|
position |
int |
setSelectedPosition
void setSelectedPosition (int rowPosition, boolean smooth, Presenter.ViewHolderTask rowHolderTask)
Selects a Row and perform an optional task on the Row. For example
setSelectedPosition(10, true, new ListRowPresenterSelectItemViewHolderTask(5))
Scroll to 11th row and selects 6th item on that row. The method will be ignored if
RowsSupportFragment has not been created (i.e. before onCreateView(LayoutInflater, ViewGroup, Bundle)
).
Parameters | |
---|---|
rowPosition |
int : Which row to select. |
smooth |
boolean : True to scroll to the row, false for no animation. |
rowHolderTask |
Presenter.ViewHolderTask : Task to perform on the Row.
|
setSelectedPosition
void setSelectedPosition (int position, boolean smooth)
Sets the selected row position.
Parameters | |
---|---|
position |
int |
smooth |
boolean |
Protected methods
findGridViewFromRoot
VerticalGridView findGridViewFromRoot (View view)
Parameters | |
---|---|
view |
View |
Returns | |
---|---|
VerticalGridView |
Interfaces
- BrowseFragment.FragmentHost
- BrowseFragment.MainFragmentAdapterProvider
- BrowseFragment.MainFragmentRowsAdapterProvider
- BrowseSupportFragment.FragmentHost
- BrowseSupportFragment.MainFragmentAdapterProvider
- BrowseSupportFragment.MainFragmentRowsAdapterProvider
- HeadersFragment.OnHeaderClickedListener
- HeadersFragment.OnHeaderViewSelectedListener
- HeadersSupportFragment.OnHeaderClickedListener
- HeadersSupportFragment.OnHeaderViewSelectedListener
- SearchFragment.SearchResultProvider
- SearchSupportFragment.SearchResultProvider
Classes
- BackgroundManager
- BaseFragment
- BaseSupportFragment
- BrandedFragment
- BrandedSupportFragment
- BrowseFragment
- BrowseFragment.BrowseTransitionListener
- BrowseFragment.FragmentFactory
- BrowseFragment.ListRowFragmentFactory
- BrowseFragment.MainFragmentAdapter
- BrowseFragment.MainFragmentAdapterRegistry
- BrowseFragment.MainFragmentRowsAdapter
- BrowseSupportFragment
- BrowseSupportFragment.BrowseTransitionListener
- BrowseSupportFragment.FragmentFactory
- BrowseSupportFragment.ListRowFragmentFactory
- BrowseSupportFragment.MainFragmentAdapter
- BrowseSupportFragment.MainFragmentAdapterRegistry
- BrowseSupportFragment.MainFragmentRowsAdapter
- DetailsFragment
- DetailsFragmentBackgroundController
- DetailsSupportFragment
- DetailsSupportFragmentBackgroundController
- ErrorFragment
- ErrorSupportFragment
- GuidedStepFragment
- GuidedStepSupportFragment
- HeadersFragment
- HeadersSupportFragment
- OnboardingFragment
- OnboardingSupportFragment
- PlaybackFragment
- PlaybackFragmentGlueHost
- PlaybackSupportFragment
- PlaybackSupportFragmentGlueHost
- ProgressBarManager
- RowsFragment
- RowsFragment.MainFragmentAdapter
- RowsFragment.MainFragmentRowsAdapter
- RowsSupportFragment
- RowsSupportFragment.MainFragmentAdapter
- RowsSupportFragment.MainFragmentRowsAdapter
- SearchFragment
- SearchSupportFragment
- VerticalGridFragment
- VerticalGridSupportFragment
- VideoFragment
- VideoFragmentGlueHost
- VideoSupportFragment
- VideoSupportFragmentGlueHost
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.