belongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1
GridLayoutManager.DefaultSpanSizeLookup
public
static
final
class
GridLayoutManager.DefaultSpanSizeLookup
extends GridLayoutManager.SpanSizeLookup
java.lang.Object | ||
↳ | android.support.v7.widget.GridLayoutManager.SpanSizeLookup | |
↳ | android.support.v7.widget.GridLayoutManager.DefaultSpanSizeLookup |
Default implementation for GridLayoutManager.SpanSizeLookup
. Each item occupies 1 span.
Summary
Public constructors | |
---|---|
GridLayoutManager.DefaultSpanSizeLookup()
|
Public methods | |
---|---|
int
|
getSpanIndex(int position, int spanCount)
Returns the final span index of the provided position. |
int
|
getSpanSize(int position)
Returns the number of span occupied by the item at |
Inherited methods | |
---|---|
From
class
android.support.v7.widget.GridLayoutManager.SpanSizeLookup
| |
From
class
java.lang.Object
|
Public constructors
GridLayoutManager.DefaultSpanSizeLookup
GridLayoutManager.DefaultSpanSizeLookup ()
Public methods
getSpanIndex
int getSpanIndex (int position, int spanCount)
Returns the final span index of the provided position.
If you have a faster way to calculate span index for your items, you should override
this method. Otherwise, you should enable span index cache
(setSpanIndexCacheEnabled(boolean)
) for better performance. When caching is
disabled, default implementation traverses all items from 0 to
position
. When caching is enabled, it calculates from the closest cached
value before the position
.
If you override this method, you need to make sure it is consistent with
getSpanSize(int)
. GridLayoutManager does not call this method for
each item. It is called only for the reference item and rest of the items
are assigned to spans based on the reference item. For example, you cannot assign a
position to span 2 while span 1 is empty.
Note that span offsets always start with 0 and are not affected by RTL.
Parameters | |
---|---|
position |
int : The position of the item |
spanCount |
int : The total number of spans in the grid |
Returns | |
---|---|
int |
The final span position of the item. Should be between 0 (inclusive) and
spanCount (exclusive)
|
getSpanSize
int getSpanSize (int position)
Returns the number of span occupied by the item at position
.
Parameters | |
---|---|
position |
int : The adapter position of the item |
Returns | |
---|---|
int |
The number of spans occupied by the item at the provided position |
Annotations
Interfaces
- ActionMenuView.OnMenuItemClickListener
- PopupMenu.OnDismissListener
- PopupMenu.OnMenuItemClickListener
- RecyclerView.ChildDrawingOrderCallback
- RecyclerView.ItemAnimator.ItemAnimatorFinishedListener
- RecyclerView.LayoutManager.LayoutPrefetchRegistry
- RecyclerView.OnChildAttachStateChangeListener
- RecyclerView.OnItemTouchListener
- RecyclerView.RecyclerListener
- RecyclerView.SmoothScroller.ScrollVectorProvider
- SearchView.OnCloseListener
- SearchView.OnQueryTextListener
- SearchView.OnSuggestionListener
- ShareActionProvider.OnShareTargetSelectedListener
- ThemedSpinnerAdapter
- Toolbar.OnMenuItemClickListener
Classes
- ActionMenuView
- ActionMenuView.LayoutParams
- AppCompatAutoCompleteTextView
- AppCompatButton
- AppCompatCheckBox
- AppCompatCheckedTextView
- AppCompatEditText
- AppCompatImageButton
- AppCompatImageView
- AppCompatMultiAutoCompleteTextView
- AppCompatRadioButton
- AppCompatRatingBar
- AppCompatSeekBar
- AppCompatSpinner
- AppCompatTextView
- CardView
- DefaultItemAnimator
- DividerItemDecoration
- GridLayout
- GridLayout.Alignment
- GridLayout.LayoutParams
- GridLayout.Spec
- GridLayoutManager
- GridLayoutManager.DefaultSpanSizeLookup
- GridLayoutManager.LayoutParams
- GridLayoutManager.SpanSizeLookup
- LinearLayoutCompat
- LinearLayoutCompat.LayoutParams
- LinearLayoutManager
- LinearLayoutManager.LayoutChunkResult
- LinearSmoothScroller
- LinearSnapHelper
- ListPopupWindow
- OrientationHelper
- PagerSnapHelper
- PopupMenu
- RecyclerView
- RecyclerView.Adapter
- RecyclerView.AdapterDataObserver
- RecyclerView.EdgeEffectFactory
- RecyclerView.ItemAnimator
- RecyclerView.ItemAnimator.ItemHolderInfo
- RecyclerView.ItemDecoration
- RecyclerView.LayoutManager
- RecyclerView.LayoutManager.Properties
- RecyclerView.LayoutParams
- RecyclerView.OnFlingListener
- RecyclerView.OnScrollListener
- RecyclerView.RecycledViewPool
- RecyclerView.Recycler
- RecyclerView.SimpleOnItemTouchListener
- RecyclerView.SmoothScroller
- RecyclerView.SmoothScroller.Action
- RecyclerView.State
- RecyclerView.ViewCacheExtension
- RecyclerView.ViewHolder
- RecyclerViewAccessibilityDelegate
- RecyclerViewAccessibilityDelegate.ItemDelegate
- SearchView
- ShareActionProvider
- SimpleItemAnimator
- SnapHelper
- StaggeredGridLayoutManager
- StaggeredGridLayoutManager.LayoutParams
- SwitchCompat
- ThemedSpinnerAdapter.Helper
- Toolbar
- Toolbar.LayoutParams
- Toolbar.SavedState
- TooltipCompat