DefaultSpanSizeLookup
class DefaultSpanSizeLookup : GridLayoutManager.SpanSizeLookup
Default implementation for SpanSizeLookup
. Each item occupies 1 span.
Summary
Inherited functions |
From class SpanSizeLookup
Int |
getSpanGroupIndex(adapterPosition: Int, spanCount: Int)
Returns the index of the group this position belongs.
For example, if grid has 3 columns and each item occupies 1 span, span group index for item 1 will be 0, item 5 will be 1.
|
Unit |
invalidateSpanGroupIndexCache()
Clears the span group index cache. GridLayoutManager automatically calls this method when adapter changes occur.
|
Unit |
invalidateSpanIndexCache()
Clears the span index cache. GridLayoutManager automatically calls this method when adapter changes occur.
|
Boolean |
isSpanGroupIndexCacheEnabled()
Returns whether results of getSpanGroupIndex(int, int) method are cached or not.
|
Boolean |
isSpanIndexCacheEnabled()
Returns whether results of getSpanIndex(int, int) method are cached or not.
|
Unit |
setSpanGroupIndexCacheEnabled(cacheSpanGroupIndices: Boolean)
Sets whether the results of getSpanGroupIndex(int, int) method should be cached or not. By default these values are not cached. If you are not overriding getSpanGroupIndex(int, int) with something highly performant, and you are using spans to calculate scrollbar offset and range, you should set this to true for better performance.
|
Unit |
setSpanIndexCacheEnabled(cacheSpanIndices: Boolean)
Sets whether the results of getSpanIndex(int, int) method should be cached or not. By default these values are not cached. If you are not overriding getSpanIndex(int, int) with something highly performant, you should set this to true for better performance.
|
|
Public constructors
<init>
DefaultSpanSizeLookup()
Default implementation for SpanSizeLookup
. Each item occupies 1 span.
Public methods
getSpanIndex
fun getSpanIndex(
position: Int,
spanCount: Int
): Int
getSpanSize
fun getSpanSize(position: Int): Int
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-07-22 UTC.