abstract class BaseGridView : RecyclerView

Known direct subclasses
HorizontalGridView

A android.view.ViewGroup that shows items in a horizontal scrolling list.

VerticalGridView

A android.view.ViewGroup that shows items in a vertically scrolling list.


An abstract base class for vertically and horizontally scrolling lists. The items come from the RecyclerView.Adapter associated with this view. Do not directly use this class, use VerticalGridView and HorizontalGridView. The class is not intended to be subclassed other than VerticalGridView and HorizontalGridView.

Summary

Nested types

Listener for intercepting key dispatch events.

Interface for receiving notification when BaseGridView has completed a full layout calculation.

Listener for intercepting generic motion dispatch events.

Listener for intercepting touch dispatch events.

Listener for intercepting unhandled key events.

Defines behavior of duration and interpolator for smoothScrollBy().

Constants

const Float

Value indicates that percent is not used.

const Int

Save on screen views plus save off screen child views without any limitation.

const Int

Save on screen views plus save off screen child views states up to getSaveChildrenLimitNumber.

const Int

Dont save states of any child views.

const Int

Only save on screen child views, the states are lost when they become off screen.

const Int

The first item and last item are aligned with the two edges of the viewport.

const Int

The last item is aligned with the high edge of the viewport when navigating to the end of list.

const Int

The first item is aligned with the low edge of the viewport.

const Int

The focused item always stays in a key line location.

const Float

Value indicates that percent is not used.

Public functions

Unit

Registers a callback to be invoked when an item in BaseGridView has been selected.

Unit

Registers a callback to be invoked when the BaseGridView completes a full layout calculation.

Unit

Undo animateOut() and slide in child views.

Unit

Temporarily slide out child views to bottom (for VerticalGridView) or end (for HorizontalGridView).

Boolean
Boolean
View?
focusSearch(direction: Int)
Int
getChildDrawingOrder(childCount: Int, i: Int)
Int

This function is deprecated.

Use getHorizontalSpacing

Int

Returns the horizontal spacing in pixels between two child items.

Int

Gets the number of items to prefetch in collectInitialPrefetchPositions, which defines how many inner items should be prefetched when this GridView is nested inside another RecyclerView.

Int

Returns number of pixels to the end of low edge.

Float

Returns the offset percent for item alignment in addition to getItemAlignmentOffset.

Int

Returns the id of the view to align with, or NO_ID for the root itemView.

BaseGridView.OnUnhandledKeyListener?

Returns the unhandled key listener.

Int

Returns the limit used when when getSaveChildrenPolicy is SAVE_LIMITED_CHILD

Int

Returns the policy for saving children.

Int

Returns the adapter position of selected item.

BaseGridView.SmoothScrollByBehavior?

Returns custom behavior for smoothScrollBy().

Int

When holding DPAD, DPAD events are generated faster than the grid view can scroll.

Float
Int

This function is deprecated.

Use getVerticalSpacing

Int

Returns the vertical spacing in pixels between two child items.

Unit

Returns the x/y offsets to final position from current position if the view is selected.

Int

Returns the method for focused item alignment in the view.

Int

Returns the offset in pixels for window alignment key line.

Float

Returns the offset percent for window alignment key line in addition to getWindowAlignmentOffset.

Boolean
Boolean

Returns true if the view at the given position has a same row sibling in front of it.

Boolean

Returns true if an animation will run when a child changes size or when adding or removing a child.

Boolean

Returns true if draws selected child at last, false otherwise.

Boolean

Returns true if focus search is disabled.

Boolean

Returns true if applies padding to item alignment when getItemAlignmentOffsetPercent is 0 or 100; returns false otherwise.

Boolean

Returns true if scrolling is enabled, false otherwise.

Boolean

Returns whether prefer key line over high edge when WINDOW_ALIGN_HIGH_EDGE is used.

Boolean

Returns whether prefer key line over low edge when WINDOW_ALIGN_LOW_EDGE is used.

Boolean
onRequestFocusInDescendants(direction: Int, previouslyFocusedRect: Rect?)
Unit
onRtlPropertiesChanged(layoutDirection: Int)

Notify layout manager that layout directionality has been updated

Unit

Remove the callback invoked when an item in BaseGridView has been selected.

Unit

Removes a callback to be invoked when the BaseGridView completes a full layout calculation.

Unit
Unit
removeViewAt(index: Int)
Unit
scrollToPosition(position: Int)

Convenience method to scroll to a certain position.

Unit
setAnimateChildLayout(animateChildLayout: Boolean)

Sets whether ItemAnimator should run when a child changes size or when adding or removing a child.

Unit

Changes and overrides children's visibility.

Unit

Enables or disables the default "focus draw at last" order rule.

Unit

Disables or enables focus search.

Unit
setGravity(gravity: Int)

Sets the gravity used for child view positioning.

Unit
Unit

This function is deprecated.

Use setHorizontalSpacing

Unit

Sets the horizontal spacing in pixels between two child items.

Unit

Sets the number of items to prefetch in collectInitialPrefetchPositions, which defines how many inner items should be prefetched when this GridView is nested inside another RecyclerView.

Unit

Sets number of pixels to the end of low edge.

Unit

Sets the offset percent for item alignment in addition to getItemAlignmentOffset.

Unit

Sets whether applies padding to item alignment when getItemAlignmentOffsetPercent is 0 or 100.

Unit

Sets the id of the view to align with.

Unit
setItemMargin(margin: Int)

This function is deprecated.

use setItemSpacing

Unit
setItemSpacing(spacing: Int)

Sets the vertical and horizontal spacing in pixels between two child items.

Unit
setLayoutEnabled(layoutEnabled: Boolean)

Enables or disables layout.

Unit

Set the LayoutManager that this RecyclerView will use.

Unit

Registers a callback to be invoked when an item in BaseGridView has been laid out.

Unit

Registers a callback to be invoked when an item in BaseGridView has been selected.

Unit

Registers a callback to be invoked when an item in BaseGridView has been selected.

Unit

Sets the key intercept listener.

Unit

Sets the generic motion intercept listener.

Unit

Sets the touch intercept listener.

Unit

Sets the unhandled key listener.

Unit
setPruneChild(pruneChild: Boolean)

Enables or disables pruning of children.

Unit

Sets the limit number when getSaveChildrenPolicy is SAVE_LIMITED_CHILD.

Unit

Sets the policy for saving children.

Unit
setScrollEnabled(scrollEnabled: Boolean)

Enables or disables scrolling.

Unit

Changes the selected item immediately without animation.

Unit
setSelectedPosition(position: Int, scrollExtra: Int)

Changes the selected item immediately without animation, scrollExtra is applied in primary scroll direction.

Unit
setSelectedPosition(position: Int, task: ViewHolderTask?)

Perform a task on ViewHolder at given position after scroll to it.

Unit

Changes the selected item and run an animation to scroll to the target position.

Unit

Perform a task on ViewHolder at given position after smooth scrolling to it.

Unit

Set custom behavior for smoothScrollBy().

Unit

When holding DPAD, DPAD events are generated faster than the grid view can scroll.

Unit
setSmoothScrollSpeedFactor(smoothScrollSpeedFactor: Float)

Set factor of how slow the smoothScroller should run.

Unit

This function is deprecated.

Use setVerticalSpacing

Unit

Sets the vertical spacing in pixels between two child items.

Unit
setWindowAlignment(windowAlignment: Int)

Sets the method for focused item alignment in the view.

Unit

Sets the offset in pixels for window alignment key line.

Unit

Sets the offset percent for window alignment key line in addition to getWindowAlignmentOffset.

Unit
setWindowAlignmentPreferKeyLineOverHighEdge(
    preferKeyLineOverHighEdge: Boolean
)

Returns whether prefer key line over high edge when WINDOW_ALIGN_HIGH_EDGE is used.

Unit
setWindowAlignmentPreferKeyLineOverLowEdge(
    preferKeyLineOverLowEdge: Boolean
)

Sets whether prefer key line over low edge when WINDOW_ALIGN_LOW_EDGE is used.

Unit
smoothScrollBy(dx: Int, dy: Int)

Animate a scroll by the given amount of pixels along either axis.

Unit
smoothScrollBy(dx: Int, dy: Int, interpolator: Interpolator?)

Animate a scroll by the given amount of pixels along either axis.

Unit

Starts a smooth scroll to an adapter position.

Protected functions

Boolean
Unit
onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect?
)

Inherited Constants

From androidx.recyclerview.widget.RecyclerView
const Int
const Int
const Long
NO_ID = -1
const Int
const Int

The RecyclerView is currently being dragged by outside input such as user touch input.

const Int

The RecyclerView is not currently scrolling.

const Int

The RecyclerView is currently animating to a final position while not under outside control.

const Int

Constant for use with setScrollingTouchSlop.

const Int

Constant for use with setScrollingTouchSlop.

const Int
UNDEFINED_DURATION = -2147483648

Constant that represents that a duration has not been defined.

const Int
From android.view.View
const Int
const Int
const Int
const Int
const Int
const Int
const Property<View!, Float!>!
const Int
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = "creditCardExpirationDate"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = "creditCardExpirationMonth"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR = "creditCardExpirationYear"
const String!
const String!
AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode"
const String!
const String!
const String!
const String!
const String!
const String!
const String!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int
const Int
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
GONE = 8
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
KEEP_SCREEN_ON = 67108864
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
NO_ID = -1
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const String!
VIEW_LOG_TAG = "View"
const Int
const IntArray<Int>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
From android.view.ViewGroup
const Int
const Int
const Int
const Int
const Int
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

Inherited functions

From androidx.core.view.NestedScrollingChild
abstract Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray?,
    offsetInWindow: IntArray?
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

abstract Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?
)

Dispatch one step of a nested scroll in progress.

abstract Boolean

Begin a nestable scroll operation along the given axes.

From androidx.core.view.NestedScrollingChild2
abstract Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray?,
    offsetInWindow: IntArray?,
    type: Int
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

abstract Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?,
    type: Int
)

Dispatch one step of a nested scroll in progress.

abstract Boolean

Returns true if this view has a nested scrolling parent for the given input type.

abstract Boolean
startNestedScroll(axes: Int, type: Int)

Begin a nestable scroll operation along the given axes, for the given input type.

abstract Unit

Stop a nested scroll in progress for the given input type.

From androidx.core.view.NestedScrollingChild3
abstract Unit
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?,
    type: Int,
    consumed: IntArray
)

Dispatch one step of a nested scroll in progress.

From androidx.recyclerview.widget.RecyclerView
Unit
addFocusables(views: ArrayList<View!>!, direction: Int, focusableMode: Int)
Unit

Add an ItemDecoration to this RecyclerView.

Unit

Add an ItemDecoration to this RecyclerView.

Unit

Register a listener that will be notified whenever a child view is attached to or detached from RecyclerView.

Unit

Add an OnItemTouchListener to intercept touch events before they are dispatched to child views or this view's standard scrolling behavior.

Unit

Add a listener that will be notified of any changes in scroll state or position.

Unit

Register a listener that will be notified whenever a child view is recycled.

Boolean
Unit

Removes all listeners that were added via addOnChildAttachStateChangeListener.

Unit

Remove all secondary listener that were notified of any changes in scroll state or position.

Int

Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range.

Int

Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range.

Int

Compute the horizontal range that the horizontal scrollbar represents.

Int

Compute the vertical extent of the vertical scrollbar's thumb within the vertical range.

Int

Compute the vertical offset of the vertical scrollbar's thumb within the vertical range.

Int

Compute the vertical range that the vertical scrollbar represents.

Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)
Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!
)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!,
    type: Int
)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!
)
Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!,
    type: Int
)

Dispatch one step of a nested scroll in progress.

Unit
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!,
    type: Int,
    consumed: IntArray
)

Dispatch one step of a nested scroll in progress.

Boolean
Unit

Override to prevent thawing of any views created by the adapter.

Unit

Override to prevent freezing of any views created by the adapter.

Unit
Boolean
drawChild(canvas: Canvas, child: View!, drawingTime: Long)
View?

Find the topmost view under the given point.

View?

Traverses the ancestors of the given view and returns the item view that contains it and also a direct child of the RecyclerView.

RecyclerView.ViewHolder?

Returns the ViewHolder that contains the given view.

RecyclerView.ViewHolder?

Return the ViewHolder for the item in the given position of the data set.

RecyclerView.ViewHolder!

Return the ViewHolder for the item with the given id.

RecyclerView.ViewHolder?

Return the ViewHolder for the item in the given position of the data set as of the latest layout pass.

RecyclerView.ViewHolder?

This function is deprecated.

use findViewHolderForLayoutPosition or findViewHolderForAdapterPosition

Boolean
fling(velocityX: Int, velocityY: Int)

Begin a standard fling with an initial velocity along each axis in pixels per second.

View!
focusSearch(focused: View!, direction: Int)

Since RecyclerView is a collection ViewGroup that includes virtual children (items that are in the Adapter but not visible in the UI), it employs a more involved focus search strategy that differs from other ViewGroups.

ViewGroup.LayoutParams!
ViewGroup.LayoutParams!
ViewGroup.LayoutParams!
CharSequence!
RecyclerView.Adapter?

Retrieves the previously set adapter or null if no adapter is set.

Int

Return the offset of the RecyclerView's text baseline from the its top boundary.

Int

Return the adapter position that the given child view corresponds to.

Long

Return the stable item id that the given child view corresponds to.

Int

Return the adapter position of the given child view as of the latest completed layout pass.

Int

This function is deprecated.

use getChildAdapterPosition or getChildLayoutPosition.

RecyclerView.ViewHolder!

Retrieve the ViewHolder for the given child view.

Boolean

Returns whether this RecyclerView will clip its children to its padding, and resize (but not clip) any EdgeEffect to the padded region, if padding is present.

RecyclerViewAccessibilityDelegate?

Returns the accessibility delegate compatibility implementation used by the RecyclerView.

Unit

Returns the bounds of the view including its decoration and margins.

RecyclerView.EdgeEffectFactory

Retrieves the previously set EdgeEffectFactory or the default factory if nothing was set.

RecyclerView.ItemAnimator?

Gets the current ItemAnimator for this RecyclerView.

RecyclerView.ItemDecoration

Returns an ItemDecoration previously added to this RecyclerView.

Int

Returns the number of ItemDecoration currently added to this RecyclerView.

RecyclerView.LayoutManager?

Return the LayoutManager currently responsible for layout policy for this RecyclerView.

Int

Returns the maximum fling velocity used by this RecyclerView.

Int

Returns the minimum velocity to start a fling.

RecyclerView.OnFlingListener?

Get the current OnFlingListener from this RecyclerView.

Boolean

Returns true if the RecyclerView should attempt to preserve currently focused Adapter Item's focus even if the View representing the Item is replaced during a layout calculation.

RecyclerView.RecycledViewPool

Retrieve this RecyclerView's RecycledViewPool.

Int

Return the current scrolling state of the RecyclerView.

Boolean
Boolean
Boolean

Returns true if this view has a nested scrolling parent for the given input type.

Boolean

Returns whether there are pending adapter updates which are not yet applied to the layout.

Unit

Invalidates all ItemDecorations.

Boolean

Returns true if RecyclerView is currently running some animations.

Boolean

Returns true if RecyclerView is attached to window.

Boolean

Returns whether RecyclerView is currently computing a layout.

Boolean

This function is deprecated.

Use isLayoutSuppressed.

Boolean

Returns whether layout and scroll calls on this container are currently being suppressed, due to an earlier call to suppressLayout.

Boolean
Unit

Same as scrollBy, but also participates in nested scrolling.

Unit

Offset the bounds of all child views by dx pixels.

Unit

Offset the bounds of all child views by dy pixels.

Unit
Unit

Called when an item view is attached to this RecyclerView.

Unit

Called when an item view is detached from this RecyclerView.

Unit
Unit
Boolean
Boolean
Unit
onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int)
Unit
onMeasure(widthSpec: Int, heightSpec: Int)
Unit
Parcelable!
Unit

Called when the scroll state of this RecyclerView changes.

Unit
onScrolled(dx: @Px Int, dy: @Px Int)

Called when the scroll position of this RecyclerView changes.

Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)
Boolean
Unit
removeDetachedView(child: View!, animate: Boolean)
Unit

Remove an ItemDecoration from this RecyclerView.

Unit

Removes the ItemDecoration associated with the supplied index position.

Unit

Removes the provided listener from child attached state listeners list.

Unit

Remove an OnItemTouchListener.

Unit

Remove a listener that was notified of any changes in scroll state or position.

Unit

Removes the provided listener from RecyclerListener list.

Unit
requestChildFocus(child: View!, focused: View!)
Boolean
requestChildRectangleOnScreen(child: View!, rect: Rect!, immediate: Boolean)
Unit
Unit
Unit
scrollBy(x: Int, y: Int)
Unit
scrollTo(x: Int, y: Int)
Unit
Unit

Sets the accessibility delegate compatibility implementation used by RecyclerView.

Unit

Set a new adapter to provide child views on demand.

Unit

Sets the ChildDrawingOrderCallback to be used for drawing children.

Unit
setClipToPadding(clipToPadding: Boolean)
java-static Unit
setDebugAssertionsEnabled(debugAssertionsEnabled: Boolean)

Enable internal assertions about RecyclerView's state and throw exceptions if the assertions are violated.

Unit

Set a EdgeEffectFactory for this RecyclerView.

Unit
setHasFixedSize(hasFixedSize: Boolean)

RecyclerView can perform several optimizations if it can know in advance that RecyclerView's size is not affected by the adapter contents.

Unit

Sets the ItemAnimator that will handle animations involving changes to the items in this RecyclerView.

Unit

Set the number of offscreen views to retain before adding them to the potentially shared recycled view pool.

Unit

This function is deprecated.

Use suppressLayout.

Unit

This function is deprecated.

Use setItemAnimator ()}.

Unit
Unit

Set a OnFlingListener for this RecyclerView.

Unit

This function is deprecated.

Use addOnScrollListener and removeOnScrollListener

Unit
setPreserveFocusAfterLayout(preserveFocusAfterLayout: Boolean)

Set whether the RecyclerView should try to keep the same Item focused after a layout calculation or not.

Unit

Recycled view pools allow multiple RecyclerViews to share a common pool of scrap views.

Unit

This function is deprecated.

Use addRecyclerListener and removeRecyclerListener

Unit
setScrollingTouchSlop(slopConstant: Int)

Configure the scrolling touch slop for a specific use case.

java-static Unit
setVerboseLoggingEnabled(verboseLoggingEnabled: Boolean)

Enable verbose logging within RecyclerView itself.

Unit

Sets a new ViewCacheExtension to be used by the Recycler.

Unit
smoothScrollBy(
    dx: @Px Int,
    dy: @Px Int,
    interpolator: Interpolator?,
    duration: Int
)

Smooth scrolls the RecyclerView by a given distance.

Boolean
Boolean
startNestedScroll(axes: Int, type: Int)

Begin a nestable scroll operation along the given axes, for the given input type.

Unit
Unit

Stop a nested scroll in progress for the given input type.

Unit

Stop any current scroll in progress, such as one started by smoothScrollBy, fling or a touch-initiated fling.

Unit

Tells this RecyclerView to suppress all layout and scroll calls until layout suppression is disabled with a later call to suppressLayout(false).

Unit
swapAdapter(
    adapter: RecyclerView.Adapter?,
    removeAndRecycleExistingViews: Boolean
)

Swaps the current adapter with the provided one.

From android.view.View
Unit
Unit
Unit
ViewPropertyAnimator!
Unit
Unit
Boolean
Unit
Unit

This function is deprecated.

Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
Unit
Boolean
Unit
Unit
java-static Int
combineMeasuredStates(curState: Int, newState: Int)
Int
Int
Int
Unit
WindowInsets!
computeSystemWindowInsets(in: WindowInsets!, outLocalInsets: Rect!)
Int
Int
Int
AccessibilityNodeInfo!
Unit
Unit

This function is deprecated.

Boolean
Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)
Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)
Boolean
dispatchNestedPrePerformAccessibilityAction(
    action: Int,
    arguments: Bundle!
)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!
)
Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!
)
Boolean
Unit
draw(canvas: Canvas!)
Unit
OnBackInvokedDispatcher!
T!
<T : View?> findViewById(id: Int)
T!
<T : View?> findViewWithTag(tag: Any!)
Boolean

This function is deprecated.

Unit
forceHasOverlappingRendering(hasOverlappingRendering: Boolean)
Unit
Unit
generateDisplayHash(
    hashAlgorithm: String!,
    bounds: Rect!,
    executor: Executor!,
    callback: DisplayHashResultCallback!
)
java-static Int
View.AccessibilityDelegate!
Int
AccessibilityNodeProvider!
CharSequence!
Int
Int
String!
String!
Float
Animation!
Matrix!
IBinder!
IntArray<Int>!
(Mutable)Map<Int!, Int!>!
Array<String!>!
AutofillId!
Int
AutofillValue!
Drawable!
BlendMode!
ColorStateList!
PorterDuff.Mode!
Int
Int
Float
Int
Float
Rect!
Boolean
getClipBounds(outRect: Rect!)
Boolean
ContentCaptureSession!
CharSequence!
Context!
ContextMenu.ContextMenuInfo!
Boolean
java-static Int
getDefaultSize(size: Int, measureSpec: Int)
Display!
IntArray<Int>!
Bitmap!

This function is deprecated.

Int

This function is deprecated.

Int

This function is deprecated.

Unit
getDrawingRect(outRect: Rect!)
Long
Float
Int
Boolean
Boolean
Int
ArrayList<View!>!
getFocusables(direction: Int)
Unit
Drawable!
Int
BlendMode!
ColorStateList!
PorterDuff.Mode!
Boolean
getGlobalVisibleRect(r: Rect!, globalOffset: Point!)
Handler!
Float
Float
Float
Float
Runnable!
Boolean
Int
Unit
getHitRect(outRect: Rect!)
Int
Int
Drawable!
Drawable!
Int
Int
Int
Int
Boolean
KeyEvent.DispatcherState!
Int
Int
Int
ViewGroup.LayoutParams!
Int
Float
Int
Boolean
Unit
Unit
Unit
Matrix!
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
View.OnFocusChangeListener!
Int
ViewOutlineProvider!
Int
Int
ViewOverlay!
Int
Int
Int
Int
Int
Int
ViewParent!
ViewParent!
Float
Float
PointerIcon!
(Mutable)List<Rect!>!
Array<String!>!
Resources!
Boolean
Int
Float
Int
AttachedSurfaceControl!
View!
WindowInsets!
Float
Float
Float
Float
Float
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
CharSequence!
StateListAnimator!
Int
Int
(Mutable)List<Rect!>!
Int

This function is deprecated.

Any!
Int
Int
CharSequence!
Int
Float
Int
TouchDelegate!
ArrayList<View!>!
Float
String!
Float
Float
Float
Long
Int
Int
Drawable!
Drawable!
Int
ViewTranslationResponse!
ViewTreeObserver!
Int
Int
Int
WindowId!
WindowInsetsController!
Int

This function is deprecated.

IBinder!
Int
Unit
Float
Float
Float
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
java-static View!
inflate(context: Context!, resource: Int, root: ViewGroup!)
Unit
invalidate(dirty: Rect!)

This function is deprecated.

Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean

This function is deprecated.

Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
View!
keyboardNavigationClusterSearch(currentCluster: View!, direction: Int)
Unit
measure(widthMeasureSpec: Int, heightMeasureSpec: Int)
java-static IntArray<Int>!
mergeDrawableStates(baseState: IntArray!, additionalState: IntArray!)
Unit
Unit
Unit
Unit
WindowInsets!
Unit
Boolean
Boolean
Unit
Unit
InputConnection!
Unit
onCreateViewTranslationRequest(
    supportedFormats: IntArray!,
    requestsCollector: Consumer<ViewTranslationRequest!>!
)
Unit
onCreateVirtualViewTranslationRequests(
    virtualIds: LongArray!,
    supportedFormats: IntArray!,
    requestsCollector: Consumer<ViewTranslationRequest!>!
)
Unit
Boolean
Unit
onDraw(canvas: Canvas!)
Unit
Unit
Boolean
Unit
Unit
Boolean
Unit
Boolean
Unit
Unit
Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)
Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent!)
Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent!)
Boolean
onKeyPreIme(keyCode: Int, event: KeyEvent!)
Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent!)
Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)
Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit
onOverScrolled(
    scrollX: Int,
    scrollY: Int,
    clampedX: Boolean,
    clampedY: Boolean
)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
ContentInfo!
Unit
Parcelable!
Unit
onScreenStateChanged(screenState: Int)
Unit
onScrollCaptureSearch(
    localVisibleRect: Rect!,
    windowOffset: Point!,
    targets: Consumer<ScrollCaptureTarget!>!
)
Unit
onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int)
Boolean
onSetAlpha(alpha: Int)
Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)
Unit
Boolean
Boolean
Unit
Unit
Unit
Unit
onVisibilityChanged(changedView: View!, visibility: Int)
Unit
onWindowFocusChanged(hasWindowFocus: Boolean)
Unit

This function is deprecated.

Unit
Boolean
overScrollBy(
    deltaX: Int,
    deltaY: Int,
    scrollX: Int,
    scrollY: Int,
    scrollRangeX: Int,
    scrollRangeY: Int,
    maxOverScrollX: Int,
    maxOverScrollY: Int,
    isTouchEvent: Boolean
)
Boolean
performAccessibilityAction(action: Int, arguments: Bundle!)
Boolean
Boolean
Boolean
performHapticFeedback(feedbackConstant: Int)
Boolean
ContentInfo!
Unit
playSoundEffect(soundConstant: Int)
Boolean
post(action: Runnable!)
Boolean
postDelayed(action: Runnable!, delayMillis: Long)
Unit
Unit
postInvalidateDelayed(delayMilliseconds: Long)
Unit
Unit
Unit
postOnAnimationDelayed(action: Runnable!, delayMillis: Long)
Unit
Unit
Boolean
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Boolean
Unit
Unit
Boolean
Unit
T!
<T : View?> requireViewById(id: Int)
Unit
java-static Int
resolveSize(size: Int, measureSpec: Int)
java-static Int
resolveSizeAndState(size: Int, measureSpec: Int, childMeasuredState: Int)
Unit
Unit
saveAttributeDataForStyleable(
    context: Context!,
    styleable: IntArray!,
    attrs: AttributeSet!,
    t: TypedArray!,
    defStyleAttr: Int,
    defStyleRes: Int
)
Unit
Unit
scheduleDrawable(who: Drawable!, what: Runnable!, when: Long)
Unit
scrollBy(x: Int, y: Int)
Unit
scrollTo(x: Int, y: Int)
Unit
Unit
Unit
setAccessibilityDataSensitive(accessibilityDataSensitive: Int)
Unit
Unit
Unit
Unit
setAccessibilityPaneTitle(accessibilityPaneTitle: CharSequence!)
Unit
Unit
Unit
setActivated(activated: Boolean)
Unit
setAllowClickWhenDisabled(clickableWhenDisabled: Boolean)
Unit
Unit
Unit
setAlpha(alpha: Float)
Unit
setAnimation(animation: Animation!)
Unit
Unit
Unit
setAutofillHints(autofillHints: Array<String!>!)
Unit
Unit
setBackground(background: Drawable!)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setBottom(bottom: Int)
Unit
Unit
setClickable(clickable: Boolean)
Unit
setClipBounds(clipBounds: Rect!)
Unit
setClipToOutline(clipToOutline: Boolean)
Unit
Unit
setContentDescription(contentDescription: CharSequence!)
Unit
setContextClickable(contextClickable: Boolean)
Unit
setDefaultFocusHighlightEnabled(defaultFocusHighlightEnabled: Boolean)
Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
Unit
setElevation(elevation: Float)
Unit
setEnabled(enabled: Boolean)
Unit
Unit
Unit
setFitsSystemWindows(fitSystemWindows: Boolean)
Unit
setFocusable(focusable: Boolean)
Unit
setFocusableInTouchMode(focusableInTouchMode: Boolean)
Unit
setFocusedByDefault(isFocusedByDefault: Boolean)
Unit
Unit
setForeground(foreground: Drawable!)
Unit
Unit
Unit
Unit
Unit
setHandwritingBoundsOffsets(
    offsetLeft: Float,
    offsetTop: Float,
    offsetRight: Float,
    offsetBottom: Float
)
Unit
Unit
setHapticFeedbackEnabled(hapticFeedbackEnabled: Boolean)
Unit
setHasTransientState(hasTransientState: Boolean)
Unit
setHorizontalFadingEdgeEnabled(horizontalFadingEdgeEnabled: Boolean)
Unit
setHorizontalScrollBarEnabled(horizontalScrollBarEnabled: Boolean)
Unit
Unit
Unit
setHovered(hovered: Boolean)
Unit
setId(id: Int)
Unit
Unit
Unit
Unit
setIsCredential(isCredential: Boolean)
Unit
setIsHandwritingDelegate(isHandwritingDelegate: Boolean)
Unit
setKeepScreenOn(keepScreenOn: Boolean)
Unit
Unit
Unit
Unit
setLayerType(layerType: Int, paint: Paint!)
Unit
setLayoutDirection(layoutDirection: Int)
Unit
Unit
setLeft(left: Int)
Unit
setLeftTopRightBottom(left: Int, top: Int, right: Int, bottom: Int)
Unit
setLongClickable(longClickable: Boolean)
Unit
setMeasuredDimension(measuredWidth: Int, measuredHeight: Int)
Unit
setMinimumHeight(minHeight: Int)
Unit
setMinimumWidth(minWidth: Int)
Unit
Unit
setNextClusterForwardId(nextClusterForwardId: Int)
Unit
setNextFocusDownId(nextFocusDownId: Int)
Unit
setNextFocusForwardId(nextFocusForwardId: Int)
Unit
setNextFocusLeftId(nextFocusLeftId: Int)
Unit
setNextFocusRightId(nextFocusRightId: Int)
Unit
setNextFocusUpId(nextFocusUpId: Int)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
setOnReceiveContentListener(
    mimeTypes: Array<String!>!,
    listener: OnReceiveContentListener!
)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setOverScrollMode(overScrollMode: Int)
Unit
setPadding(left: Int, top: Int, right: Int, bottom: Int)
Unit
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int)
Unit
setPivotX(pivotX: Float)
Unit
setPivotY(pivotY: Float)
Unit
setPointerIcon(pointerIcon: PointerIcon!)
Unit
setPreferKeepClear(preferKeepClear: Boolean)
Unit
Unit
setPressed(pressed: Boolean)
Unit
setRenderEffect(renderEffect: RenderEffect!)
Unit
setRevealOnFocusHint(revealOnFocus: Boolean)
Unit
setRight(right: Int)
Unit
setRotation(rotation: Float)
Unit
setRotationX(rotationX: Float)
Unit
setRotationY(rotationY: Float)
Unit
Unit
Unit
setScaleX(scaleX: Float)
Unit
setScaleY(scaleY: Float)
Unit
setScreenReaderFocusable(screenReaderFocusable: Boolean)
Unit
setScrollBarDefaultDelayBeforeFade(
    scrollBarDefaultDelayBeforeFade: Int
)
Unit
setScrollBarFadeDuration(scrollBarFadeDuration: Int)
Unit
setScrollBarSize(scrollBarSize: Int)
Unit
Unit
Unit
Unit
setScrollContainer(isScrollContainer: Boolean)
Unit
setScrollIndicators(indicators: Int)
Unit
setScrollX(value: Int)
Unit
setScrollY(value: Int)
Unit
Unit
setSelected(selected: Boolean)
Unit
setSoundEffectsEnabled(soundEffectsEnabled: Boolean)
Unit
setStateDescription(stateDescription: CharSequence!)
Unit
Unit
Unit

This function is deprecated.

Unit
setTag(tag: Any!)
Unit
setTextAlignment(textAlignment: Int)
Unit
setTextDirection(textDirection: Int)
Unit
Unit
setTop(top: Int)
Unit
Unit
Unit
setTransitionName(transitionName: String!)
Unit
Unit
setTranslationX(translationX: Float)
Unit
setTranslationY(translationY: Float)
Unit
setTranslationZ(translationZ: Float)
Unit
setVerticalFadingEdgeEnabled(verticalFadingEdgeEnabled: Boolean)
Unit
setVerticalScrollBarEnabled(verticalScrollBarEnabled: Boolean)
Unit
Unit
Unit
Unit
Unit
setVisibility(visibility: Int)
Unit
setWillNotCacheDrawing(willNotCacheDrawing: Boolean)

This function is deprecated.

Unit
setWillNotDraw(willNotDraw: Boolean)
Unit
setX(x: Float)
Unit
setY(y: Float)
Unit
setZ(z: Float)
Boolean
ActionMode!
Unit
Boolean
startDrag(
    data: ClipData!,
    shadowBuilder: View.DragShadowBuilder!,
    myLocalState: Any!,
    flags: Int
)

This function is deprecated.

Boolean
startDragAndDrop(
    data: ClipData!,
    shadowBuilder: View.DragShadowBuilder!,
    myLocalState: Any!,
    flags: Int
)
Boolean
Unit
String!
Unit
Unit
Unit
Unit
Boolean
Boolean

This function is deprecated.

Boolean
From android.view.ViewGroup
Unit
Unit
addExtraDataToAccessibilityNodeInfo(
    info: AccessibilityNodeInfo!,
    extraDataKey: String!,
    arguments: Bundle!
)
Unit
addFocusables(views: ArrayList<View!>!, direction: Int, focusableMode: Int)
Unit
addKeyboardNavigationClusters(
    views: (Mutable)Collection<View!>!,
    direction: Int
)
Boolean
Unit
Unit
addView(child: View!)
Boolean
addViewInLayout(child: View!, index: Int, params: ViewGroup.LayoutParams!)
Unit
attachLayoutAnimationParameters(
    child: View!,
    params: ViewGroup.LayoutParams!,
    index: Int,
    count: Int
)
Unit
attachViewToParent(child: View!, index: Int, params: ViewGroup.LayoutParams!)
Unit
Boolean
Boolean
Unit
Unit
childHasTransientStateChanged(
    child: View!,
    childHasTransientState: Boolean
)
Unit
Unit
Unit
Unit
Unit
debug(depth: Int)
Unit
Unit
Unit
detachViewsFromParent(start: Int, count: Int)
WindowInsets!
Boolean
Unit
Unit
dispatchCreateViewTranslationRequest(
    viewIds: (Mutable)Map<AutofillId!, LongArray!>!,
    supportedFormats: IntArray!,
    capability: TranslationCapability!,
    requests: (Mutable)List<ViewTranslationRequest!>!
)
Unit
Boolean
Unit
dispatchDraw(canvas: Canvas!)
Unit
Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
Unit
Unit
Unit
Unit
dispatchScrollCaptureSearch(
    localVisibleRect: Rect!,
    windowOffset: Point!,
    targets: Consumer<ScrollCaptureTarget!>!
)
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Unit
Boolean
Boolean
dispatchUnhandledMove(focused: View!, direction: Int)
Unit
dispatchVisibilityChanged(changedView: View!, visibility: Int)
Unit
Unit
Unit
WindowInsets!
dispatchWindowInsetsAnimationProgress(
    insets: WindowInsets!,
    runningAnimations: (Mutable)List<WindowInsetsAnimation!>!
)
WindowInsetsAnimation.Bounds!
Unit

This function is deprecated.

Unit
Boolean
drawChild(canvas: Canvas!, child: View!, drawingTime: Long)
Unit
Unit
View!
OnBackInvokedDispatcher!
Unit
findViewsWithText(
    outViews: ArrayList<View!>!,
    text: CharSequence!,
    flags: Int
)
View!
focusSearch(focused: View!, direction: Int)
Unit
Boolean
ViewGroup.LayoutParams!
ViewGroup.LayoutParams!
CharSequence!
View!
getChildAt(index: Int)
Int
Int
getChildDrawingOrder(childCount: Int, drawingPosition: Int)
java-static Int
getChildMeasureSpec(spec: Int, padding: Int, childDimension: Int)
Boolean
Boolean
getChildVisibleRect(child: View!, r: Rect!, offset: Point!)
Boolean
Boolean
Int
View!
LayoutAnimationController!
Animation.AnimationListener!
Int
LayoutTransition!
Int
ViewGroupOverlay!
Int

This function is deprecated.

Boolean
Boolean
Boolean
Int
indexOfChild(child: View!)
Unit
invalidateChild(child: View!, dirty: Rect!)

This function is deprecated.

ViewParent!
invalidateChildInParent(location: IntArray!, dirty: Rect!)

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean
Boolean

This function is deprecated.

Boolean
Boolean
Boolean
Unit
Unit
layout(l: Int, t: Int, r: Int, b: Int)
Unit
measureChild(
    child: View!,
    parentWidthMeasureSpec: Int,
    parentHeightMeasureSpec: Int
)
Unit
measureChildWithMargins(
    child: View!,
    parentWidthMeasureSpec: Int,
    widthUsed: Int,
    parentHeightMeasureSpec: Int,
    heightUsed: Int
)
Unit
measureChildren(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit
notifySubtreeAccessibilityStateChanged(
    child: View!,
    source: View!,
    changeType: Int
)
Unit
offsetDescendantRectToMyCoords(descendant: View!, rect: Rect!)
Unit
offsetRectIntoDescendantCoords(descendant: View!, rect: Rect!)
Unit
IntArray<Int>!
Unit
onDescendantInvalidated(child: View!, target: View!)
Unit
Boolean
Boolean
abstract Unit
onLayout(p: Boolean, p1: Int, p2: Int, p3: Int, p4: Int)
Boolean
onNestedFling(
    target: View!,
    velocityX: Float,
    velocityY: Float,
    consumed: Boolean
)
Boolean
onNestedPreFling(target: View!, velocityX: Float, velocityY: Float)
Boolean
onNestedPrePerformAccessibilityAction(
    target: View!,
    action: Int,
    args: Bundle!
)
Unit
onNestedPreScroll(target: View!, dx: Int, dy: Int, consumed: IntArray!)
Unit
onNestedScroll(
    target: View!,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int
)
Unit
onNestedScrollAccepted(child: View!, target: View!, axes: Int)
Boolean
onRequestFocusInDescendants(direction: Int, previouslyFocusedRect: Rect!)
Boolean
PointerIcon!
onResolvePointerIcon(event: MotionEvent!, pointerIndex: Int)
Boolean
onStartNestedScroll(child: View!, target: View!, nestedScrollAxes: Int)
Unit
Unit
onViewAdded(child: View!)
Unit
Unit
Unit
Unit
Unit
removeDetachedView(child: View!, animate: Boolean)
Unit
Unit
removeViews(start: Int, count: Int)
Unit
removeViewsInLayout(start: Int, count: Int)
Unit
requestChildFocus(child: View!, focused: View!)
Boolean
requestChildRectangleOnScreen(
    child: View!,
    rectangle: Rect!,
    immediate: Boolean
)
Unit
Boolean
requestFocus(direction: Int, previouslyFocusedRect: Rect!)
Boolean
Unit
Boolean
Unit
Unit
Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
Unit

This function is deprecated.

Unit
setClipChildren(clipChildren: Boolean)
Unit
setClipToPadding(clipToPadding: Boolean)
Unit
Unit
Unit
Unit
setLayoutMode(layoutMode: Int)
Unit
Unit
Unit
Unit
setPersistentDrawingCache(drawingCacheToKeep: Int)

This function is deprecated.

Unit
Unit
setTouchscreenBlocksFocus(touchscreenBlocksFocus: Boolean)
Unit
setTransitionGroup(isTransitionGroup: Boolean)
Unit
Boolean
Boolean
showContextMenuForChild(originalView: View!)
ActionMode!
startActionModeForChild(
    originalView: View!,
    callback: ActionMode.Callback!
)
Unit
Unit
Unit
Unit

Constants

ITEM_ALIGN_OFFSET_PERCENT_DISABLED

Added in 1.0.0-alpha03
const val ITEM_ALIGN_OFFSET_PERCENT_DISABLED = -1.0f: Float

Value indicates that percent is not used.

SAVE_ALL_CHILD

Added in 1.0.0-alpha03
const val SAVE_ALL_CHILD = 3: Int

Save on screen views plus save off screen child views without any limitation. This might cause out of memory, only use it when you are dealing with limited data.

SAVE_LIMITED_CHILD

Added in 1.0.0-alpha03
const val SAVE_LIMITED_CHILD = 2: Int

Save on screen views plus save off screen child views states up to getSaveChildrenLimitNumber.

SAVE_NO_CHILD

Added in 1.0.0-alpha03
const val SAVE_NO_CHILD = 0: Int

Dont save states of any child views.

SAVE_ON_SCREEN_CHILD

Added in 1.0.0-alpha03
const val SAVE_ON_SCREEN_CHILD = 1: Int

Only save on screen child views, the states are lost when they become off screen.

WINDOW_ALIGN_BOTH_EDGE

Added in 1.0.0-alpha03
const val WINDOW_ALIGN_BOTH_EDGE = 3: Int

The first item and last item are aligned with the two edges of the viewport. When navigating in the middle of list, the focus maintains a key line location.

The key line location is calculated by "windowAlignOffset" and "windowAlignOffsetPercent"; if neither of these two is defined, the default value is 1/2 of the size.

WINDOW_ALIGN_HIGH_EDGE

Added in 1.0.0-alpha03
const val WINDOW_ALIGN_HIGH_EDGE = 2: Int

The last item is aligned with the high edge of the viewport when navigating to the end of list. When navigating away from the end, the focus item is aligned to a key line location.

For HorizontalGridView, high edge refers to getWidth() - getPaddingRight() when RTL is false or getPaddingLeft() when RTL is true. For VerticalGridView, high edge refers to getHeight() - getPaddingBottom().

The key line location is calculated by "windowAlignOffset" and "windowAlignOffsetPercent"; if neither of these two is defined, the default value is 1/2 of the size.

Note if there are very few items between high edge and key line, use setWindowAlignmentPreferKeyLineOverHighEdge to control whether you prefer to align the items to key line or high edge. Default is preferring key line.

WINDOW_ALIGN_LOW_EDGE

Added in 1.0.0-alpha03
const val WINDOW_ALIGN_LOW_EDGE = 1: Int

The first item is aligned with the low edge of the viewport. When navigating away from the first item, the focus item is aligned to a key line location.

For HorizontalGridView, low edge refers to getPaddingLeft() when RTL is false or getWidth() - getPaddingRight() when RTL is true. For VerticalGridView, low edge refers to getPaddingTop().

The key line location is calculated by "windowAlignOffset" and "windowAlignOffsetPercent"; if neither of these two is defined, the default value is 1/2 of the size.

Note if there are very few items between low edge and key line, use setWindowAlignmentPreferKeyLineOverLowEdge to control whether you prefer to align the items to key line or low edge. Default is preferring low edge.

WINDOW_ALIGN_NO_EDGE

Added in 1.0.0-alpha03
const val WINDOW_ALIGN_NO_EDGE = 0: Int

The focused item always stays in a key line location.

The key line location is calculated by "windowAlignOffset" and "windowAlignOffsetPercent"; if neither of these two is defined, the default value is 1/2 of the size.

WINDOW_ALIGN_OFFSET_PERCENT_DISABLED

Added in 1.0.0-alpha03
const val WINDOW_ALIGN_OFFSET_PERCENT_DISABLED = -1.0f: Float

Value indicates that percent is not used.

Public functions

addOnChildViewHolderSelectedListener

Added in 1.0.0-alpha03
fun addOnChildViewHolderSelectedListener(
    listener: OnChildViewHolderSelectedListener
): Unit

Registers a callback to be invoked when an item in BaseGridView has been selected. Note that the listener may be invoked when there is a layout pending on the view, affording the listener an opportunity to adjust the upcoming layout based on the selection state.

Parameters
listener: OnChildViewHolderSelectedListener

The listener to be invoked.

addOnLayoutCompletedListener

Added in 1.0.0-alpha03
fun addOnLayoutCompletedListener(
    listener: BaseGridView.OnLayoutCompletedListener
): Unit

Registers a callback to be invoked when the BaseGridView completes a full layout calculation.

Parameters
listener: BaseGridView.OnLayoutCompletedListener

The listener to be invoked.

animateIn

Added in 1.0.0-alpha03
fun animateIn(): Unit

Undo animateOut() and slide in child views.

animateOut

Added in 1.0.0-alpha03
fun animateOut(): Unit

Temporarily slide out child views to bottom (for VerticalGridView) or end (for HorizontalGridView). Layout and scrolling will be suppressed until animateIn is called.

dispatchKeyEvent

fun dispatchKeyEvent(event: KeyEvent): Boolean

dispatchTouchEvent

fun dispatchTouchEvent(event: MotionEvent): Boolean

focusSearch

fun focusSearch(direction: Int): View?

getChildDrawingOrder

Added in 1.0.0-alpha03
fun getChildDrawingOrder(childCount: Int, i: Int): Int

getHorizontalMargin

Added in 1.0.0-alpha03
Deprecated in 1.0.0-alpha03
fun getHorizontalMargin(): Int

Returns the spacing in pixels between two child items horizontally.

getHorizontalSpacing

Added in 1.0.0-alpha03
fun getHorizontalSpacing(): Int

Returns the horizontal spacing in pixels between two child items.

Returns
Int

The Horizontal spacing in pixels between two child items.

getInitialPrefetchItemCount

Added in 1.0.0-alpha03
fun getInitialPrefetchItemCount(): Int

Gets the number of items to prefetch in collectInitialPrefetchPositions, which defines how many inner items should be prefetched when this GridView is nested inside another RecyclerView.

Returns
Int

number of items to prefetch.

getItemAlignmentOffset

Added in 1.0.0-alpha03
fun getItemAlignmentOffset(): Int

Returns number of pixels to the end of low edge. Supports right to left layout direction. In left to right or vertical case, it's the offset added to left/top edge. In right to left case, it's the offset subtracted from right edge. Item alignment settings are ignored for the child if ItemAlignmentFacet is provided by RecyclerView.ViewHolder or FacetProviderAdapter.

Returns
Int

The number of pixels to the end of low edge.

getItemAlignmentOffsetPercent

Added in 1.0.0-alpha03
fun getItemAlignmentOffsetPercent(): Float

Returns the offset percent for item alignment in addition to getItemAlignmentOffset.

Returns
Float

Percentage to offset. E.g., 40 means 40% of the width from the low edge, or ITEM_ALIGN_OFFSET_PERCENT_DISABLED if disabled. Default value is 50.

getItemAlignmentViewId

Added in 1.0.0-alpha03
fun getItemAlignmentViewId(): Int

Returns the id of the view to align with, or NO_ID for the root itemView.

Returns
Int

The id of the view to align with, or NO_ID for the root itemView.

getOnUnhandledKeyListener

Added in 1.0.0-alpha03
fun getOnUnhandledKeyListener(): BaseGridView.OnUnhandledKeyListener?

Returns the unhandled key listener.

Returns
BaseGridView.OnUnhandledKeyListener?

The unhandled key listener.

getSaveChildrenLimitNumber

Added in 1.0.0-alpha03
fun getSaveChildrenLimitNumber(): Int

Returns the limit used when when getSaveChildrenPolicy is SAVE_LIMITED_CHILD

getSaveChildrenPolicy

Added in 1.0.0-alpha03
fun getSaveChildrenPolicy(): Int

Returns the policy for saving children.

getSelectedPosition

Added in 1.0.0-alpha03
fun getSelectedPosition(): Int

Returns the adapter position of selected item.

Returns
Int

The adapter position of selected item.

getSmoothScrollByBehavior

Added in 1.0.0-alpha03
fun getSmoothScrollByBehavior(): BaseGridView.SmoothScrollByBehavior?

Returns custom behavior for smoothScrollBy().

Returns
BaseGridView.SmoothScrollByBehavior?

Custom behavior for SmoothScrollBy(). Null for default behavior.

getSmoothScrollMaxPendingMoves

Added in 1.0.0-alpha03
fun getSmoothScrollMaxPendingMoves(): Int

When holding DPAD, DPAD events are generated faster than the grid view can scroll. The grid view counts unhandled DPAD events and complete the movement after user release DPAD. If the value is set too high, the scrolling will last very long after DPAD is released. If the value is set too low, it may miss many DPAD events. The default value is 10. If app increases setSmoothScrollSpeedFactor, it may need decrease the max pending DPAD events to avoid scrolling too long after DPAD release.

Returns
Int

Maximum number of pending DPAD events to be remembered when smooth scroll cannot catch up speed of DPAD events being sent.

getSmoothScrollSpeedFactor

Added in 1.0.0-alpha03
fun getSmoothScrollSpeedFactor(): Float
Returns
Float

Factor of how slow the smoothScroller runs. Default value is 1f.

getVerticalMargin

Added in 1.0.0-alpha03
Deprecated in 1.0.0-alpha03
fun getVerticalMargin(): Int

Returns the spacing in pixels between two child items vertically.

getVerticalSpacing

Added in 1.0.0-alpha03
fun getVerticalSpacing(): Int

Returns the vertical spacing in pixels between two child items.

Returns
Int

The vertical spacing in pixels between two child items.

getViewSelectedOffsets

Added in 1.0.0-alpha03
fun getViewSelectedOffsets(view: View, offsets: IntArray): Unit

Returns the x/y offsets to final position from current position if the view is selected.

Parameters
view: View

The view to get offsets.

offsets: IntArray

offsets[0] holds offset of X, offsets[1] holds offset of Y.

getWindowAlignment

Added in 1.0.0-alpha03
fun getWindowAlignment(): Int

Returns the method for focused item alignment in the view.

getWindowAlignmentOffset

Added in 1.0.0-alpha03
fun getWindowAlignmentOffset(): Int

Returns the offset in pixels for window alignment key line.

Returns
Int

The number of pixels to offset. If the offset is positive, it is distance from low edge (see WINDOW_ALIGN_LOW_EDGE); if the offset is negative, the absolute value is distance from high edge (see WINDOW_ALIGN_HIGH_EDGE). Default value is 0.

getWindowAlignmentOffsetPercent

Added in 1.0.0-alpha03
fun getWindowAlignmentOffsetPercent(): Float

Returns the offset percent for window alignment key line in addition to getWindowAlignmentOffset.

Returns
Float

Percentage to offset. E.g., 40 means 40% of the width from the low edge, or WINDOW_ALIGN_OFFSET_PERCENT_DISABLED if disabled. Default value is 50.

hasOverlappingRendering

fun hasOverlappingRendering(): Boolean

hasPreviousViewInSameRow

Added in 1.0.0-alpha03
fun hasPreviousViewInSameRow(position: Int): Boolean

Returns true if the view at the given position has a same row sibling in front of it. This will return true if first item view is not created.

Parameters
position: Int

Position in adapter.

Returns
Boolean

True if the view at the given position has a same row sibling in front of it.

isChildLayoutAnimated

Added in 1.0.0-alpha03
fun isChildLayoutAnimated(): Boolean

Returns true if an animation will run when a child changes size or when adding or removing a child.

Returns
Boolean

True if ItemAnimator is enabled, false otherwise.

isFocusDrawingOrderEnabled

Added in 1.0.0-alpha03
fun isFocusDrawingOrderEnabled(): Boolean

Returns true if draws selected child at last, false otherwise. Default is enabled.

Returns
Boolean

True if draws selected child at last, false otherwise.

isFocusSearchDisabled

Added in 1.0.0-alpha03
fun isFocusSearchDisabled(): Boolean

Returns true if focus search is disabled.

Returns
Boolean

True if focus search is disabled.

isItemAlignmentOffsetWithPadding

Added in 1.0.0-alpha03
fun isItemAlignmentOffsetWithPadding(): Boolean

Returns true if applies padding to item alignment when getItemAlignmentOffsetPercent is 0 or 100; returns false otherwise.

When true: Applies start/top padding when getItemAlignmentOffsetPercent is 0. Applies end/bottom padding when getItemAlignmentOffsetPercent is 100. Does not apply padding if getItemAlignmentOffsetPercent is neither 0 nor 100.

When false: does not apply padding

isScrollEnabled

Added in 1.0.0-alpha03
fun isScrollEnabled(): Boolean

Returns true if scrolling is enabled, false otherwise.

Returns
Boolean

True if scrolling is enabled, false otherwise.

isWindowAlignmentPreferKeyLineOverHighEdge

Added in 1.0.0-alpha03
fun isWindowAlignmentPreferKeyLineOverHighEdge(): Boolean

Returns whether prefer key line over high edge when WINDOW_ALIGN_HIGH_EDGE is used. When true, if there are very few items between high edge and key line, align items to key line instead of align items to high edge. Default value is true (aka prefer align to key line).

Returns
Boolean

True to prefer key line over high edge, false otherwise.

isWindowAlignmentPreferKeyLineOverLowEdge

Added in 1.0.0-alpha03
fun isWindowAlignmentPreferKeyLineOverLowEdge(): Boolean

Returns whether prefer key line over low edge when WINDOW_ALIGN_LOW_EDGE is used. When true, if there are very few items between low edge and key line, align items to key line instead of align items to low edge. Default value is false (aka prefer align to low edge).

Returns
Boolean

True to prefer key line over low edge, false otherwise.

onRequestFocusInDescendants

Added in 1.0.0-alpha03
fun onRequestFocusInDescendants(direction: Int, previouslyFocusedRect: Rect?): Boolean

onRtlPropertiesChanged

fun onRtlPropertiesChanged(layoutDirection: Int): Unit

Notify layout manager that layout directionality has been updated

removeOnChildViewHolderSelectedListener

Added in 1.0.0-alpha03
fun removeOnChildViewHolderSelectedListener(
    listener: OnChildViewHolderSelectedListener
): Unit

Remove the callback invoked when an item in BaseGridView has been selected.

Parameters
listener: OnChildViewHolderSelectedListener

The listener to be removed.

removeOnLayoutCompletedListener

Added in 1.0.0-alpha03
fun removeOnLayoutCompletedListener(
    listener: BaseGridView.OnLayoutCompletedListener
): Unit

Removes a callback to be invoked when the BaseGridView completes a full layout calculation.

Parameters
listener: BaseGridView.OnLayoutCompletedListener

The listener to be invoked.

removeView

fun removeView(view: View): Unit

removeViewAt

fun removeViewAt(index: Int): Unit

scrollToPosition

fun scrollToPosition(position: Int): Unit

Convenience method to scroll to a certain position. RecyclerView does not implement scrolling logic, rather forwards the call to scrollToPosition

Parameters
position: Int

Scroll to this adapter position

See also
scrollToPosition

setAnimateChildLayout

Added in 1.0.0-alpha03
fun setAnimateChildLayout(animateChildLayout: Boolean): Unit

Sets whether ItemAnimator should run when a child changes size or when adding or removing a child.

Parameters
animateChildLayout: Boolean

True to enable ItemAnimator, false to disable.

setChildrenVisibility

Added in 1.0.0-alpha03
fun setChildrenVisibility(visibility: Int): Unit

Changes and overrides children's visibility.

Parameters
visibility: Int

See getVisibility.

setFocusDrawingOrderEnabled

Added in 1.0.0-alpha03
fun setFocusDrawingOrderEnabled(enabled: Boolean): Unit

Enables or disables the default "focus draw at last" order rule. Default is enabled.

Parameters
enabled: Boolean

True to draw the selected child at last, false otherwise.

setFocusSearchDisabled

Added in 1.0.0-alpha03
fun setFocusSearchDisabled(disabled: Boolean): Unit

Disables or enables focus search.

Parameters
disabled: Boolean

True to disable focus search, false to enable.

setGravity

Added in 1.0.0-alpha03
fun setGravity(gravity: Int): Unit

Sets the gravity used for child view positioning. Defaults to GRAVITY_TOP|GRAVITY_START.

Parameters
gravity: Int

See android.view.Gravity

setHasOverlappingRendering

Added in 1.0.0-alpha03
fun setHasOverlappingRendering(hasOverlapping: Boolean): Unit

setHorizontalMargin

Added in 1.0.0-alpha03
Deprecated in 1.0.0-alpha03
fun setHorizontalMargin(margin: Int): Unit

Sets the spacing in pixels between two child items horizontally.

setHorizontalSpacing

Added in 1.0.0-alpha03
fun setHorizontalSpacing(spacing: Int): Unit

Sets the horizontal spacing in pixels between two child items.

Parameters
spacing: Int

Horizontal spacing in pixels between two child items.

setInitialPrefetchItemCount

Added in 1.0.0-alpha03
fun setInitialPrefetchItemCount(itemCount: Int): Unit

Sets the number of items to prefetch in collectInitialPrefetchPositions, which defines how many inner items should be prefetched when this GridView is nested inside another RecyclerView.

Set this value to the number of items this inner GridView will display when it is first scrolled into the viewport. RecyclerView will attempt to prefetch that number of items so they are ready, avoiding jank as the inner GridView is scrolled into the viewport.

For example, take a VerticalGridView of scrolling HorizontalGridViews. The rows always have 6 items visible in them (or 7 if not aligned). Passing 6 to this method for each inner GridView will enable RecyclerView's prefetching feature to do create/bind work for 6 views within a row early, before it is scrolled on screen, instead of just the default 4.

Calling this method does nothing unless the LayoutManager is in a RecyclerView nested in another RecyclerView.

Note: Setting this value to be larger than the number of views that will be visible in this view can incur unnecessary bind work, and an increase to the number of Views created and in active use.

Parameters
itemCount: Int

Number of items to prefetch

setItemAlignmentOffset

Added in 1.0.0-alpha03
fun setItemAlignmentOffset(offset: Int): Unit

Sets number of pixels to the end of low edge. Supports right to left layout direction. Item alignment settings are ignored for the child if ItemAlignmentFacet is provided by RecyclerView.ViewHolder or FacetProviderAdapter.

Parameters
offset: Int

In left to right or vertical case, it's the offset added to left/top edge. In right to left case, it's the offset subtracted from right edge.

setItemAlignmentOffsetPercent

Added in 1.0.0-alpha03
fun setItemAlignmentOffsetPercent(offsetPercent: Float): Unit

Sets the offset percent for item alignment in addition to getItemAlignmentOffset. Item alignment settings are ignored for the child if ItemAlignmentFacet is provided by RecyclerView.ViewHolder or FacetProviderAdapter.

Parameters
offsetPercent: Float

Percentage to offset. E.g., 40 means 40% of the width from the low edge. Use ITEM_ALIGN_OFFSET_PERCENT_DISABLED to disable.

setItemAlignmentOffsetWithPadding

Added in 1.0.0-alpha03
fun setItemAlignmentOffsetWithPadding(withPadding: Boolean): Unit

Sets whether applies padding to item alignment when getItemAlignmentOffsetPercent is 0 or 100.

When true: Applies start/top padding if getItemAlignmentOffsetPercent is 0. Applies end/bottom padding if getItemAlignmentOffsetPercent is 100. Does not apply padding if getItemAlignmentOffsetPercent is neither 0 nor 100.

When false: does not apply padding

setItemAlignmentViewId

Added in 1.0.0-alpha03
fun setItemAlignmentViewId(viewId: Int): Unit

Sets the id of the view to align with. Use NO_ID (default) for the root itemView. Item alignment settings on BaseGridView are if ItemAlignmentFacet is provided by RecyclerView.ViewHolder or FacetProviderAdapter.

setItemMargin

Added in 1.0.0-alpha03
Deprecated in 1.0.0-alpha03
fun setItemMargin(margin: Int): Unit

Sets the spacing in pixels between two child items.

setItemSpacing

Added in 1.0.0-alpha03
fun setItemSpacing(spacing: Int): Unit

Sets the vertical and horizontal spacing in pixels between two child items.

Parameters
spacing: Int

Vertical and horizontal spacing in pixels between two child items.

setLayoutEnabled

Added in 1.0.0-alpha03
fun setLayoutEnabled(layoutEnabled: Boolean): Unit

Enables or disables layout. All children will be removed when layout is disabled.

Parameters
layoutEnabled: Boolean

True to enable layout, false otherwise.

setLayoutManager

fun setLayoutManager(layout: RecyclerView.LayoutManager?): Unit

Set the LayoutManager that this RecyclerView will use.

In contrast to other adapter-backed views such as android.widget.ListView or android.widget.GridView, RecyclerView allows client code to provide custom layout arrangements for child views. These arrangements are controlled by the LayoutManager. A LayoutManager must be provided for RecyclerView to function.

Several default strategies are provided for common uses such as lists and grids.

Parameters
layout: RecyclerView.LayoutManager?

LayoutManager to use

setOnChildLaidOutListener

Added in 1.0.0-alpha03
fun setOnChildLaidOutListener(listener: OnChildLaidOutListener?): Unit

Registers a callback to be invoked when an item in BaseGridView has been laid out.

Parameters
listener: OnChildLaidOutListener?

The listener to be invoked.

setOnChildSelectedListener

Added in 1.0.0-alpha03
fun setOnChildSelectedListener(listener: OnChildSelectedListener?): Unit

Registers a callback to be invoked when an item in BaseGridView has been selected. Note that the listener may be invoked when there is a layout pending on the view, affording the listener an opportunity to adjust the upcoming layout based on the selection state.

Parameters
listener: OnChildSelectedListener?

The listener to be invoked.

setOnChildViewHolderSelectedListener

Added in 1.0.0-alpha03
fun setOnChildViewHolderSelectedListener(
    listener: OnChildViewHolderSelectedListener?
): Unit

Registers a callback to be invoked when an item in BaseGridView has been selected. Note that the listener may be invoked when there is a layout pending on the view, affording the listener an opportunity to adjust the upcoming layout based on the selection state. This method will clear all existing listeners added by addOnChildViewHolderSelectedListener.

Parameters
listener: OnChildViewHolderSelectedListener?

The listener to be invoked.

setOnKeyInterceptListener

Added in 1.0.0-alpha03
fun setOnKeyInterceptListener(
    listener: BaseGridView.OnKeyInterceptListener?
): Unit

Sets the key intercept listener.

Parameters
listener: BaseGridView.OnKeyInterceptListener?

The key intercept listener.

setOnMotionInterceptListener

Added in 1.0.0-alpha03
fun setOnMotionInterceptListener(
    listener: BaseGridView.OnMotionInterceptListener?
): Unit

Sets the generic motion intercept listener.

Parameters
listener: BaseGridView.OnMotionInterceptListener?

The motion intercept listener.

setOnTouchInterceptListener

Added in 1.0.0-alpha03
fun setOnTouchInterceptListener(
    listener: BaseGridView.OnTouchInterceptListener?
): Unit

Sets the touch intercept listener.

Parameters
listener: BaseGridView.OnTouchInterceptListener?

The touch intercept listener.

setOnUnhandledKeyListener

Added in 1.0.0-alpha03
fun setOnUnhandledKeyListener(
    listener: BaseGridView.OnUnhandledKeyListener?
): Unit

Sets the unhandled key listener.

Parameters
listener: BaseGridView.OnUnhandledKeyListener?

The unhandled key intercept listener.

setPruneChild

Added in 1.0.0-alpha03
fun setPruneChild(pruneChild: Boolean): Unit

Enables or disables pruning of children. Disable is useful during transition.

Parameters
pruneChild: Boolean

True to prune children out side visible area, false to enable.

setSaveChildrenLimitNumber

Added in 1.0.0-alpha03
fun setSaveChildrenLimitNumber(limitNumber: Int): Unit

Sets the limit number when getSaveChildrenPolicy is SAVE_LIMITED_CHILD.

setSaveChildrenPolicy

Added in 1.0.0-alpha03
fun setSaveChildrenPolicy(savePolicy: Int): Unit

Sets the policy for saving children.

setScrollEnabled

Added in 1.0.0-alpha03
fun setScrollEnabled(scrollEnabled: Boolean): Unit

Enables or disables scrolling. Disable is useful during transition.

Parameters
scrollEnabled: Boolean

True to enable scroll, false to disable.

setSelectedPosition

Added in 1.0.0-alpha03
fun setSelectedPosition(position: Int): Unit

Changes the selected item immediately without animation.

setSelectedPosition

Added in 1.0.0-alpha03
fun setSelectedPosition(position: Int, scrollExtra: Int): Unit

Changes the selected item immediately without animation, scrollExtra is applied in primary scroll direction. The scrollExtra will be kept until another setSelectedPosition or setSelectedPositionSmooth call.

setSelectedPosition

Added in 1.0.0-alpha03
fun setSelectedPosition(position: Int, task: ViewHolderTask?): Unit

Perform a task on ViewHolder at given position after scroll to it.

Parameters
position: Int

Position of item in adapter.

task: ViewHolderTask?

Task to executed on the ViewHolder at a given position.

setSelectedPositionSmooth

Added in 1.0.0-alpha03
fun setSelectedPositionSmooth(position: Int): Unit

Changes the selected item and run an animation to scroll to the target position.

Parameters
position: Int

Adapter position of the item to select.

setSelectedPositionSmooth

Added in 1.0.0-alpha03
fun setSelectedPositionSmooth(position: Int, task: ViewHolderTask?): Unit

Perform a task on ViewHolder at given position after smooth scrolling to it.

Parameters
position: Int

Position of item in adapter.

task: ViewHolderTask?

Task to executed on the ViewHolder at a given position.

setSmoothScrollByBehavior

Added in 1.0.0-alpha03
fun setSmoothScrollByBehavior(
    behavior: BaseGridView.SmoothScrollByBehavior?
): Unit

Set custom behavior for smoothScrollBy().

Parameters
behavior: BaseGridView.SmoothScrollByBehavior?

Custom behavior of SmoothScrollBy(). Null for default behavior.

setSmoothScrollMaxPendingMoves

Added in 1.0.0-alpha03
fun setSmoothScrollMaxPendingMoves(maxPendingMoves: Int): Unit

When holding DPAD, DPAD events are generated faster than the grid view can scroll. The grid view counts unhandled DPAD events and completes the movement after user release DPAD. If the value is set too high, the scrolling will last very long after DPAD is released. If the value is set too low, it may miss many DPAD events. The default value is 10. If app increases setSmoothScrollSpeedFactor, it may need decrease the max pending DPAD events to avoid scrolling too long after DPAD release.

Parameters
maxPendingMoves: Int

Maximum number of pending DPAD events to be remembered.

setSmoothScrollSpeedFactor

Added in 1.0.0-alpha03
fun setSmoothScrollSpeedFactor(smoothScrollSpeedFactor: Float): Unit

Set factor of how slow the smoothScroller should run. For example when set to 2f, the smooth scroller is twice slower. The value is 1f by default.

Parameters
smoothScrollSpeedFactor: Float

Factor of how slow the smooth scroll is.

setVerticalMargin

Added in 1.0.0-alpha03
Deprecated in 1.0.0-alpha03
fun setVerticalMargin(margin: Int): Unit

Sets the spacing in pixels between two child items vertically.

setVerticalSpacing

Added in 1.0.0-alpha03
fun setVerticalSpacing(spacing: Int): Unit

Sets the vertical spacing in pixels between two child items.

Parameters
spacing: Int

Vertical spacing between two child items.

setWindowAlignment

Added in 1.0.0-alpha03
fun setWindowAlignment(windowAlignment: Int): Unit

Sets the method for focused item alignment in the view.

setWindowAlignmentOffset

Added in 1.0.0-alpha03
fun setWindowAlignmentOffset(offset: Int): Unit

Sets the offset in pixels for window alignment key line.

Parameters
offset: Int

The number of pixels to offset. If the offset is positive, it is distance from low edge (see WINDOW_ALIGN_LOW_EDGE); if the offset is negative, the absolute value is distance from high edge (see WINDOW_ALIGN_HIGH_EDGE). Default value is 0.

setWindowAlignmentOffsetPercent

Added in 1.0.0-alpha03
fun setWindowAlignmentOffsetPercent(offsetPercent: Float): Unit

Sets the offset percent for window alignment key line in addition to getWindowAlignmentOffset.

Parameters
offsetPercent: Float

Percentage to offset. E.g., 40 means 40% of the width from low edge. Use WINDOW_ALIGN_OFFSET_PERCENT_DISABLED to disable. Default value is 50.

setWindowAlignmentPreferKeyLineOverHighEdge

Added in 1.0.0-alpha03
fun setWindowAlignmentPreferKeyLineOverHighEdge(
    preferKeyLineOverHighEdge: Boolean
): Unit

Returns whether prefer key line over high edge when WINDOW_ALIGN_HIGH_EDGE is used. When true, if there are very few items between high edge and key line, align items to key line instead of align items to high edge. Default value is true (aka prefer align to key line).

Parameters
preferKeyLineOverHighEdge: Boolean

True to prefer key line over high edge, false otherwise.

setWindowAlignmentPreferKeyLineOverLowEdge

Added in 1.0.0-alpha03
fun setWindowAlignmentPreferKeyLineOverLowEdge(
    preferKeyLineOverLowEdge: Boolean
): Unit

Sets whether prefer key line over low edge when WINDOW_ALIGN_LOW_EDGE is used. When true, if there are very few items between low edge and key line, align items to key line instead of align items to low edge. Default value is false (aka prefer align to low edge).

Parameters
preferKeyLineOverLowEdge: Boolean

True to prefer key line over low edge, false otherwise.

smoothScrollBy

fun smoothScrollBy(dx: Int, dy: Int): Unit

Animate a scroll by the given amount of pixels along either axis.

Parameters
dx: Int

Pixels to scroll horizontally

dy: Int

Pixels to scroll vertically

smoothScrollBy

fun smoothScrollBy(dx: Int, dy: Int, interpolator: Interpolator?): Unit

Animate a scroll by the given amount of pixels along either axis.

Parameters
dx: Int

Pixels to scroll horizontally

dy: Int

Pixels to scroll vertically

interpolator: Interpolator?

Interpolator to be used for scrolling. If it is null, RecyclerView will use an internal default interpolator.

smoothScrollToPosition

fun smoothScrollToPosition(position: Int): Unit

Starts a smooth scroll to an adapter position.

To support smooth scrolling, you must override smoothScrollToPosition and create a SmoothScroller.

LayoutManager is responsible for creating the actual scroll action. If you want to provide a custom smooth scroll logic, override smoothScrollToPosition in your LayoutManager.

Parameters
position: Int

The adapter position to scroll to

Protected functions

dispatchGenericFocusedEvent

protected fun dispatchGenericFocusedEvent(event: MotionEvent): Boolean

onFocusChanged

protected fun onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect?
): Unit