Unit |
addDisappearingView(child: View!)
To be called only during onLayoutChildren(Recycler, State) to add a view to the layout that is known to be going away, either because it has been removed or because it is actually not in the visible portion of the container but is being laid out in order to inform RecyclerView in how to animate the item out of view.
Views added via this method are going to be invisible to LayoutManager after the dispatchLayout pass is complete. They cannot be retrieved via getChildAt(int) or won't be included in getChildCount() method.
|
Unit |
addDisappearingView(child: View!, index: Int)
To be called only during onLayoutChildren(Recycler, State) to add a view to the layout that is known to be going away, either because it has been removed or because it is actually not in the visible portion of the container but is being laid out in order to inform RecyclerView in how to animate the item out of view.
Views added via this method are going to be invisible to LayoutManager after the dispatchLayout pass is complete. They cannot be retrieved via getChildAt(int) or won't be included in getChildCount() method.
|
Unit |
addView(child: View!)
Add a view to the currently attached RecyclerView if needed. LayoutManagers should use this method to add views obtained from a Recycler using Recycler#getViewForPosition(int) .
|
Unit |
addView(child: View!, index: Int)
Add a view to the currently attached RecyclerView if needed. LayoutManagers should use this method to add views obtained from a Recycler using Recycler#getViewForPosition(int) .
|
Unit |
assertInLayoutOrScroll(message: String!)
Checks if RecyclerView is in the middle of a layout or scroll and throws an IllegalStateException if it is not.
|
Unit |
attachView(@NonNull child: View, index: Int, lp: RecyclerView.LayoutParams!)
Reattach a previously detached view. This method should not be used to reattach views that were previously detachAndScrapView(android.view.View, RecyclerView.Recycler) scrapped}.
|
Unit |
attachView(@NonNull child: View, index: Int)
Reattach a previously detached view. This method should not be used to reattach views that were previously detachAndScrapView(android.view.View, RecyclerView.Recycler) scrapped}.
|
Unit |
attachView(@NonNull child: View)
Reattach a previously detached view. This method should not be used to reattach views that were previously detachAndScrapView(android.view.View, RecyclerView.Recycler) scrapped}.
|
Unit |
calculateItemDecorationsForChild(@NonNull child: View, @NonNull outRect: Rect)
Calculates the item decor insets applied to the given child and updates the provided Rect instance with the inset values.
- The Rect's left is set to the total width of left decorations.
- The Rect's top is set to the total height of top decorations.
- The Rect's right is set to the total width of right decorations.
- The Rect's bottom is set to total height of bottom decorations.
Note that item decorations are automatically calculated when one of the LayoutManager's measure child methods is called. If you need to measure the child with custom specs via View#measure(int, int) , you can use this method to get decorations.
|
Boolean |
checkLayoutParams(lp: RecyclerView.LayoutParams!)
Determines the validity of the supplied LayoutParams object.
This should check to make sure that the object is of the correct type and all values are within acceptable ranges. The default implementation returns true for non-null params.
|
Int |
chooseSize(spec: Int, desired: Int, min: Int)
Chooses a size from the given specs and parameters that is closest to the desired size and also complies with the spec.
|
Unit |
detachAndScrapAttachedViews(@NonNull recycler: RecyclerView.Recycler)
Temporarily detach and scrap all currently attached child views. Views will be scrapped into the given Recycler. The Recycler may prefer to reuse scrap views before other views that were previously recycled.
|
Unit |
detachAndScrapView(@NonNull child: View, @NonNull recycler: RecyclerView.Recycler)
Detach a child view and add it to a Recycler's scrap heap.
Scrapping a view allows it to be rebound and reused to show updated or different data.
|
Unit |
detachAndScrapViewAt(index: Int, @NonNull recycler: RecyclerView.Recycler)
Detach a child view and add it to a Recycler's scrap heap.
Scrapping a view allows it to be rebound and reused to show updated or different data.
|
Unit |
detachView(@NonNull child: View)
Temporarily detach a child view.
LayoutManagers may want to perform a lightweight detach operation to rearrange views currently attached to the RecyclerView. Generally LayoutManager implementations will want to use detachAndScrapView(android.view.View, RecyclerView.Recycler) so that the detached view may be rebound and reused.
If a LayoutManager uses this method to detach a view, it must reattach or fully remove the detached view before the LayoutManager entry point method called by RecyclerView returns.
|
Unit |
detachViewAt(index: Int)
Temporarily detach a child view.
LayoutManagers may want to perform a lightweight detach operation to rearrange views currently attached to the RecyclerView. Generally LayoutManager implementations will want to use detachAndScrapView(android.view.View, RecyclerView.Recycler) so that the detached view may be rebound and reused.
If a LayoutManager uses this method to detach a view, it must reattach or fully remove the detached view before the LayoutManager entry point method called by RecyclerView returns.
|
Unit |
endAnimation(view: View!)
Ends all animations on the view created by the ItemAnimator .
|
View? |
findContainingItemView(@NonNull view: View)
Traverses the ancestors of the given view and returns the item view that contains it and also a direct child of the LayoutManager.
Note that this method may return null if the view is a child of the RecyclerView but not a child of the LayoutManager (e.g. running a disappear animation).
|
RecyclerView.LayoutParams! |
generateLayoutParams(lp: LayoutParams!)
Create a LayoutParams object suitable for this LayoutManager, copying relevant values from the supplied LayoutParams object if possible.
Important: if you use your own custom LayoutParams type you must also override checkLayoutParams(LayoutParams) , generateLayoutParams(android.view.ViewGroup.LayoutParams) and generateLayoutParams(android.content.Context, android.util.AttributeSet) .
|
RecyclerView.LayoutParams! |
generateLayoutParams(c: Context!, attrs: AttributeSet!)
Create a LayoutParams object suitable for this LayoutManager from an inflated layout resource.
Important: if you use your own custom LayoutParams type you must also override checkLayoutParams(LayoutParams) , generateLayoutParams(android.view.ViewGroup.LayoutParams) and generateLayoutParams(android.content.Context, android.util.AttributeSet) .
|
Int |
getBaseline()
Returns offset of the RecyclerView's text baseline from the its top boundary.
|
Int |
getBottomDecorationHeight(@NonNull child: View)
Returns the total height of item decorations applied to child's bottom.
Note that this value is not updated until the View is measured or calculateItemDecorationsForChild(View, Rect) is called.
|
View? |
getChildAt(index: Int)
Return the child view at the given index
|
Int |
getChildCount()
Return the current number of child views attached to the parent RecyclerView. This does not include child views that were temporarily detached and/or scrapped.
|
Int |
getChildMeasureSpec(parentSize: Int, padding: Int, childDimension: Int, canScroll: Boolean)
Calculate a MeasureSpec value for measuring a child view in one dimension.
|
Int |
getChildMeasureSpec(parentSize: Int, parentMode: Int, padding: Int, childDimension: Int, canScroll: Boolean)
Calculate a MeasureSpec value for measuring a child view in one dimension.
|
Boolean |
getClipToPadding()
Check if the RecyclerView is configured to clip child views to its padding.
|
Int |
getColumnCountForAccessibility(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State)
Returns the number of columns for accessibility.
Default implementation returns the number of items in the adapter if LayoutManager supports horizontal scrolling or 1 if LayoutManager does not support horizontal scrolling.
|
Int |
getDecoratedBottom(@NonNull child: View)
Returns the bottom edge of the given child view within its parent, offset by any applied ItemDecorations .
|
Unit |
getDecoratedBoundsWithMargins(@NonNull view: View, @NonNull outBounds: Rect)
Returns the bounds of the view including its decoration and margins.
|
Int |
getDecoratedLeft(@NonNull child: View)
Returns the left edge of the given child view within its parent, offset by any applied ItemDecorations .
|
Int |
getDecoratedMeasuredHeight(@NonNull child: View)
Returns the measured height of the given child, plus the additional size of any insets applied by ItemDecorations .
|
Int |
getDecoratedMeasuredWidth(@NonNull child: View)
Returns the measured width of the given child, plus the additional size of any insets applied by ItemDecorations .
|
Int |
getDecoratedRight(@NonNull child: View)
Returns the right edge of the given child view within its parent, offset by any applied ItemDecorations .
|
Int |
getDecoratedTop(@NonNull child: View)
Returns the top edge of the given child view within its parent, offset by any applied ItemDecorations .
|
View? |
getFocusedChild()
Returns the item View which has or contains focus.
|
Int |
getHeight()
Returns the height that is currently relevant to the LayoutManager.
This value is usually equal to the laid out height of the RecyclerView but may reflect the current android.view.View.MeasureSpec height if the LayoutManager is using AutoMeasure and the RecyclerView is in the process of measuring. The LayoutManager must always use this method to retrieve the height relevant to it at any given time.
|
Int |
getHeightMode()
Return the height measurement spec mode that is currently relevant to the LayoutManager.
This value is set only if the LayoutManager opts into the AutoMeasure api via setAutoMeasureEnabled(boolean) .
When RecyclerView is running a layout, this value is always set to View.MeasureSpec#EXACTLY even if it was measured with a different spec mode.
|
Int |
getItemCount()
Returns the number of items in the adapter bound to the parent RecyclerView.
Note that this number is not necessarily equal to State#getItemCount() . In methods where State is available, you should use State#getItemCount() instead. For more details, check the documentation for State#getItemCount() .
|
Int |
getItemViewType(@NonNull view: View)
Returns the View type defined by the adapter.
|
Int |
getLayoutDirection()
Returns the resolved layout direction for this RecyclerView.
|
Int |
getLeftDecorationWidth(@NonNull child: View)
Returns the total width of item decorations applied to child's left.
Note that this value is not updated until the View is measured or calculateItemDecorationsForChild(View, Rect) is called.
|
Int |
getMinimumHeight()
|
Int |
getMinimumWidth()
|
Int |
getPaddingBottom()
Return the bottom padding of the parent RecyclerView
|
Int |
getPaddingEnd()
Return the end padding of the parent RecyclerView
|
Int |
getPaddingLeft()
Return the left padding of the parent RecyclerView
|
Int |
getPaddingRight()
Return the right padding of the parent RecyclerView
|
Int |
getPaddingStart()
Return the start padding of the parent RecyclerView
|
Int |
getPaddingTop()
Return the top padding of the parent RecyclerView
|
Int |
getPosition(@NonNull view: View)
Returns the adapter position of the item represented by the given View. This does not contain any adapter changes that might have happened after the last layout.
|
RecyclerView.LayoutManager.Properties! |
getProperties(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int)
Parse the xml attributes to get the most common properties used by layout managers. android.R.attr#orientation androidx.recyclerview.R.attr#spanCount androidx.recyclerview.R.attr#reverseLayout androidx.recyclerview.R.attr#stackFromEnd
|
Int |
getRightDecorationWidth(@NonNull child: View)
Returns the total width of item decorations applied to child's right.
Note that this value is not updated until the View is measured or calculateItemDecorationsForChild(View, Rect) is called.
|
Int |
getRowCountForAccessibility(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State)
Returns the number of rows for accessibility.
Default implementation returns the number of items in the adapter if LayoutManager supports vertical scrolling or 1 if LayoutManager does not support vertical scrolling.
|
Int |
getSelectionModeForAccessibility(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State)
Returns the selection mode for accessibility. Should be AccessibilityNodeInfoCompat.CollectionInfoCompat#SELECTION_MODE_NONE , AccessibilityNodeInfoCompat.CollectionInfoCompat#SELECTION_MODE_SINGLE or AccessibilityNodeInfoCompat.CollectionInfoCompat#SELECTION_MODE_MULTIPLE .
Default implementation returns AccessibilityNodeInfoCompat.CollectionInfoCompat#SELECTION_MODE_NONE .
|
Int |
getTopDecorationHeight(@NonNull child: View)
Returns the total height of item decorations applied to child's top.
Note that this value is not updated until the View is measured or calculateItemDecorationsForChild(View, Rect) is called.
|
Unit |
getTransformedBoundingBox(@NonNull child: View, includeDecorInsets: Boolean, @NonNull out: Rect)
Calculates the bounding box of the View while taking into account its matrix changes (translation, scale etc) with respect to the RecyclerView.
If includeDecorInsets is true , they are applied first before applying the View's matrix so that the decor offsets also go through the same transformation.
|
Int |
getWidth()
Returns the width that is currently relevant to the LayoutManager.
This value is usually equal to the laid out width of the RecyclerView but may reflect the current android.view.View.MeasureSpec width if the LayoutManager is using AutoMeasure and the RecyclerView is in the process of measuring. The LayoutManager must always use this method to retrieve the width relevant to it at any given time.
|
Int |
getWidthMode()
Return the width measurement spec mode that is currently relevant to the LayoutManager.
This value is set only if the LayoutManager opts into the AutoMeasure api via setAutoMeasureEnabled(boolean) .
When RecyclerView is running a layout, this value is always set to View.MeasureSpec#EXACTLY even if it was measured with a different spec mode.
|
Boolean |
hasFocus()
Returns true if the RecyclerView this LayoutManager is bound to has or contains focus.
|
Unit |
ignoreView(@NonNull view: View)
Flags a view so that it will not be scrapped or recycled.
Scope of ignoring a child is strictly restricted to position tracking, scrapping and recyling. Methods like removeAndRecycleAllViews(Recycler) will ignore the child whereas removeAllViews() or offsetChildrenHorizontal(int) will not ignore the child.
Before this child can be recycled again, you have to call stopIgnoringView(View) .
You can call this method only if your LayoutManger is in onLayout or onScroll callback.
|
Boolean |
isAttachedToWindow()
Returns whether LayoutManager is currently attached to a RecyclerView which is attached to a window.
|
Boolean |
isFocused()
Returns true if the RecyclerView this LayoutManager is bound to has focus.
|
Boolean |
isItemPrefetchEnabled()
Sets whether the LayoutManager should be queried for views outside of its viewport while the UI thread is idle between frames.
|
Boolean |
isLayoutHierarchical(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State)
Returns whether layout is hierarchical or not to be used for accessibility.
Default implementation returns false.
|
Boolean |
isMeasurementCacheEnabled()
In addition to the View Framework's measurement cache, RecyclerView uses its own additional measurement cache for its children to avoid re-measuring them when not necessary. It is on by default but it can be turned off via setMeasurementCacheEnabled(boolean) .
|
Boolean |
isSmoothScrolling()
|
Boolean |
isViewPartiallyVisible(@NonNull child: View, completelyVisible: Boolean, acceptEndPointInclusion: Boolean)
Returns whether the given child view is partially or fully visible within the padded bounded area of RecyclerView, depending on the input parameters. A view is partially visible if it has non-zero overlap with RV's padded bounded area. If acceptEndPointInclusion flag is set to true, it's also considered partially visible if it's located outside RV's bounds and it's hitting either RV's start or end bounds.
|
Unit |
layoutDecorated(@NonNull child: View, left: Int, top: Int, right: Int, bottom: Int)
Lay out the given child view within the RecyclerView using coordinates that include any current ItemDecorations .
LayoutManagers should prefer working in sizes and coordinates that include item decoration insets whenever possible. This allows the LayoutManager to effectively ignore decoration insets within measurement and layout code. See the following methods:
|
Unit |
layoutDecoratedWithMargins(@NonNull child: View, left: Int, top: Int, right: Int, bottom: Int)
Lay out the given child view within the RecyclerView using coordinates that include any current ItemDecorations and margins.
LayoutManagers should prefer working in sizes and coordinates that include item decoration insets whenever possible. This allows the LayoutManager to effectively ignore decoration insets within measurement and layout code. See the following methods:
|
Unit |
measureChild(@NonNull child: View, widthUsed: Int, heightUsed: Int)
Measure a child view using standard measurement policy, taking the padding of the parent RecyclerView and any added item decorations into account.
If the RecyclerView can be scrolled in either dimension the caller may pass 0 as the widthUsed or heightUsed parameters as they will be irrelevant.
|
Unit |
measureChildWithMargins(@NonNull child: View, widthUsed: Int, heightUsed: Int)
Measure a child view using standard measurement policy, taking the padding of the parent RecyclerView, any added item decorations and the child margins into account.
If the RecyclerView can be scrolled in either dimension the caller may pass 0 as the widthUsed or heightUsed parameters as they will be irrelevant.
|
Unit |
moveView(fromIndex: Int, toIndex: Int)
Moves a View from one position to another.
|
Unit |
offsetChildrenHorizontal(@Px dx: Int)
Offset all child views attached to the parent RecyclerView by dx pixels along the horizontal axis.
|
Unit |
offsetChildrenVertical(@Px dy: Int)
Offset all child views attached to the parent RecyclerView by dy pixels along the vertical axis.
|
Unit |
onAdapterChanged(@Nullable oldAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder!>?, @Nullable newAdapter: RecyclerView.Adapter<RecyclerView.ViewHolder!>?)
Called if the RecyclerView this LayoutManager is bound to has a different adapter set via RecyclerView#setAdapter(Adapter) or RecyclerView#swapAdapter(Adapter, boolean) . The LayoutManager may use this opportunity to clear caches and configure state such that it can relayout appropriately with the new data and potentially new view types.
The default implementation removes all currently attached views.
|
Boolean |
onAddFocusables(@NonNull recyclerView: RecyclerView, @NonNull views: ArrayList<View!>, direction: Int, focusableMode: Int)
Called to populate focusable views within the RecyclerView.
The LayoutManager implementation should return true if the default behavior of ViewGroup#addFocusables(java.util.ArrayList, int) should be suppressed.
The default implementation returns false to trigger RecyclerView to fall back to the default ViewGroup behavior.
|
Unit |
onAttachedToWindow(view: RecyclerView!)
Called when this LayoutManager is both attached to a RecyclerView and that RecyclerView is attached to a window.
If the RecyclerView is re-attached with the same LayoutManager and Adapter, it may not call onLayoutChildren(Recycler, State) if nothing has changed and a layout was not requested on the RecyclerView while it was detached.
Subclass implementations should always call through to the superclass implementation.
|
Unit |
onDetachedFromWindow(view: RecyclerView!)
|
Unit |
onInitializeAccessibilityEvent(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State, @NonNull event: AccessibilityEvent)
Called by the accessibility delegate to initialize an accessibility event.
Default implementation adds item count and scroll information to the event.
|
Unit |
onInitializeAccessibilityNodeInfo(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State, @NonNull info: AccessibilityNodeInfoCompat)
Called by the AccessibilityDelegate when the information about the current layout should be populated.
Default implementation adds a .
You should override getRowCountForAccessibility(RecyclerView.Recycler, RecyclerView.State) , getColumnCountForAccessibility(RecyclerView.Recycler, RecyclerView.State) , isLayoutHierarchical(RecyclerView.Recycler, RecyclerView.State) and getSelectionModeForAccessibility(RecyclerView.Recycler, RecyclerView.State) for more accurate accessibility information.
|
Unit |
onInitializeAccessibilityNodeInfoForItem(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State, @NonNull host: View, @NonNull info: AccessibilityNodeInfoCompat)
Called by the AccessibilityDelegate when the accessibility information for a specific item should be populated.
Default implementation adds basic positioning information about the item.
|
View? |
onInterceptFocusSearch(@NonNull focused: View, direction: Int)
This method gives a LayoutManager an opportunity to intercept the initial focus search before the default behavior of FocusFinder is used. If this method returns null FocusFinder will attempt to find a focusable child view. If it fails then onFocusSearchFailed(View, int, RecyclerView.Recycler, RecyclerView.State) will be called to give the LayoutManager an opportunity to add new views for items that did not have attached views representing them. The LayoutManager should not add or remove views from this method.
|
Unit |
onItemsAdded(@NonNull recyclerView: RecyclerView, positionStart: Int, itemCount: Int)
Called when items have been added to the adapter. The LayoutManager may choose to requestLayout if the inserted items would require refreshing the currently visible set of child views. (e.g. currently empty space would be filled by appended items, etc.)
|
Unit |
onItemsChanged(@NonNull recyclerView: RecyclerView)
Called in response to a call to Adapter#notifyDataSetChanged() or RecyclerView#swapAdapter(Adapter, boolean) ()} and signals that the the entire data set has changed.
|
Unit |
onItemsMoved(@NonNull recyclerView: RecyclerView, from: Int, to: Int, itemCount: Int)
Called when an item is moved withing the adapter.
Note that, an item may also change position in response to another ADD/REMOVE/MOVE operation. This callback is only called if and only if Adapter#notifyItemMoved is called.
|
Unit |
onItemsRemoved(@NonNull recyclerView: RecyclerView, positionStart: Int, itemCount: Int)
Called when items have been removed from the adapter.
|
Unit |
onItemsUpdated(@NonNull recyclerView: RecyclerView, positionStart: Int, itemCount: Int)
Called when items have been changed in the adapter. To receive payload, override onItemsUpdated(RecyclerView, int, int, Object) instead, then this callback will not be invoked.
|
Unit |
onItemsUpdated(@NonNull recyclerView: RecyclerView, positionStart: Int, itemCount: Int, @Nullable payload: Any?)
Called when items have been changed in the adapter and with optional payload. Default implementation calls onItemsUpdated(RecyclerView, int, int) .
|
Unit |
onMeasure(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State, widthSpec: Int, heightSpec: Int)
Measure the attached RecyclerView. Implementations must call setMeasuredDimension(int, int) before returning.
It is strongly advised to use the AutoMeasure mechanism by overriding isAutoMeasureEnabled() to return true as AutoMeasure handles all the standard measure cases including when the RecyclerView's layout_width or layout_height have been set to wrap_content. If isAutoMeasureEnabled() is overridden to return true, this method should not be overridden.
The default implementation will handle EXACTLY measurements and respect the minimum width and height properties of the host RecyclerView if measured as UNSPECIFIED. AT_MOST measurements will be treated as EXACTLY and the RecyclerView will consume all available space.
|
Boolean |
onRequestChildFocus(@NonNull parent: RecyclerView, @NonNull child: View, @Nullable focused: View?)
|
Boolean |
onRequestChildFocus(@NonNull parent: RecyclerView, @NonNull state: RecyclerView.State, @NonNull child: View, @Nullable focused: View?)
Called when a descendant view of the RecyclerView requests focus.
A LayoutManager wishing to keep focused views aligned in a specific portion of the view may implement that behavior in an override of this method.
If the LayoutManager executes different behavior that should override the default behavior of scrolling the focused child on screen instead of running alongside it, this method should return true.
|
Unit |
onScrollStateChanged(state: Int)
RecyclerView calls this method to notify LayoutManager that scroll state has changed.
|
Boolean |
performAccessibilityAction(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State, action: Int, @Nullable args: Bundle?)
Called by AccessibilityDelegate when an action is requested from the RecyclerView.
|
Boolean |
performAccessibilityActionForItem(@NonNull recycler: RecyclerView.Recycler, @NonNull state: RecyclerView.State, @NonNull view: View, action: Int, @Nullable args: Bundle?)
Called by AccessibilityDelegate when an accessibility action is requested on one of the children of LayoutManager.
Default implementation does not do anything.
|
Unit |
postOnAnimation(action: Runnable!)
Causes the Runnable to execute on the next animation time step. The runnable will be run on the user interface thread.
Calling this method when LayoutManager is not attached to a RecyclerView has no effect.
|
Unit |
removeAllViews()
Remove all views from the currently attached RecyclerView. This will not recycle any of the affected views; the LayoutManager is responsible for doing so if desired.
|
Unit |
removeAndRecycleAllViews(@NonNull recycler: RecyclerView.Recycler)
Removes all views and recycles them using the given recycler.
If you want to clean cached views as well, you should call Recycler#clear() too.
If a View is marked as "ignored", it is not removed nor recycled.
|
Unit |
removeAndRecycleView(@NonNull child: View, @NonNull recycler: RecyclerView.Recycler)
Remove a child view and recycle it using the given Recycler.
|
Unit |
removeAndRecycleViewAt(index: Int, @NonNull recycler: RecyclerView.Recycler)
Remove a child view and recycle it using the given Recycler.
|
Boolean |
removeCallbacks(action: Runnable!)
Removes the specified Runnable from the message queue.
Calling this method when LayoutManager is not attached to a RecyclerView has no effect.
|
Unit |
removeDetachedView(@NonNull child: View)
Finish removing a view that was previously temporarily detached .
|
Unit |
removeView(child: View!)
Remove a view from the currently attached RecyclerView if needed. LayoutManagers should use this method to completely remove a child view that is no longer needed. LayoutManagers should strongly consider recycling removed views using Recycler#recycleView(android.view.View) .
|
Unit |
removeViewAt(index: Int)
Remove a view from the currently attached RecyclerView if needed. LayoutManagers should use this method to completely remove a child view that is no longer needed. LayoutManagers should strongly consider recycling removed views using Recycler#recycleView(android.view.View) .
|
Boolean |
requestChildRectangleOnScreen(@NonNull parent: RecyclerView, @NonNull child: View, @NonNull rect: Rect, immediate: Boolean)
Called when a child of the RecyclerView wants a particular rectangle to be positioned onto the screen. See ViewParent#requestChildRectangleOnScreen(android.view.View, * android.graphics.Rect, boolean) for more details.
The base implementation will attempt to perform a standard programmatic scroll to bring the given rect into view, within the padded area of the RecyclerView.
|
Boolean |
requestChildRectangleOnScreen(@NonNull parent: RecyclerView, @NonNull child: View, @NonNull rect: Rect, immediate: Boolean, focusedChildVisible: Boolean)
Requests that the given child of the RecyclerView be positioned onto the screen. This method can be called for both unfocusable and focusable child views. For unfocusable child views, focusedChildVisible is typically true in which case, layout manager makes the child view visible only if the currently focused child stays in-bounds of RV.
|
Unit |
requestLayout()
Calls RecyclerView#requestLayout on the underlying RecyclerView
|
Unit |
requestSimpleAnimationsInNextLayout()
A LayoutManager can call this method to force RecyclerView to run simple animations in the next layout pass, even if there is not any trigger to do so. (e.g. adapter data change).
Note that, calling this method will not guarantee that RecyclerView will run animations at all. For example, if there is not any ItemAnimator set, RecyclerView will not run any animations but will still clear this flag after the layout is complete.
|
Unit |
setAutoMeasureEnabled(enabled: Boolean)
Defines whether the measuring pass of layout should use the AutoMeasure mechanism of RecyclerView or if it should be done by the LayoutManager's implementation of LayoutManager#onMeasure(Recycler, State, int, int) .
|
Unit |
setItemPrefetchEnabled(enabled: Boolean)
Sets whether the LayoutManager should be queried for views outside of its viewport while the UI thread is idle between frames.
If enabled, the LayoutManager will be queried for items to inflate/bind in between view system traversals on devices running API 21 or greater. Default value is true.
On platforms API level 21 and higher, the UI thread is idle between passing a frame to RenderThread and the starting up its next frame at the next VSync pulse. By prefetching out of window views in this time period, delays from inflation and view binding are much less likely to cause jank and stuttering during scrolls and flings.
While prefetch is enabled, it will have the side effect of expanding the effective size of the View cache to hold prefetched views.
|
Unit |
setMeasuredDimension(childrenBounds: Rect!, wSpec: Int, hSpec: Int)
Sets the measured dimensions from the given bounding box of the children and the measurement specs that were passed into RecyclerView#onMeasure(int, int) . It is only called if a LayoutManager returns true from isAutoMeasureEnabled() and it is called after the RecyclerView calls LayoutManager#onLayoutChildren(Recycler, State) in the execution of RecyclerView#onMeasure(int, int) .
This method must call setMeasuredDimension(int, int) .
The default implementation adds the RecyclerView's padding to the given bounding box then caps the value to be within the given measurement specs.
|
Unit |
setMeasuredDimension(widthSize: Int, heightSize: Int)
Set the measured dimensions of the host RecyclerView.
|
Unit |
setMeasurementCacheEnabled(measurementCacheEnabled: Boolean)
Sets whether RecyclerView should use its own measurement cache for the children. This is a more aggressive cache than the framework uses.
|
Unit |
startSmoothScroll(smoothScroller: RecyclerView.SmoothScroller!)
Starts a smooth scroll using the provided SmoothScroller .
Each instance of SmoothScroller is intended to only be used once. Provide a new SmoothScroller instance each time this method is called.
Calling this method will cancel any previous smooth scroll request.
|
Unit |
stopIgnoringView(@NonNull view: View)
View can be scrapped and recycled again.
Note that calling this method removes all information in the view holder.
You can call this method only if your LayoutManger is in onLayout or onScroll callback.
|