ViewCompat

open class ViewCompat
kotlin.Any
   ↳ androidx.core.view.ViewCompat

Helper for accessing features in View.

Summary

Nested classes
abstract

Interface definition for a callback to be invoked when a hardware key event hasn't been handled by the view hierarchy.

Constants
static Int

Always allow a user to over-scroll this view, provided it is a view that can scroll.

static Int

Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll.

static Int

Never allow a user to over-scroll this view.

static Int

Automatically determine whether a view is important for accessibility.

static Int

The view is important for accessibility.

static Int

The view is not important for accessibility.

static Int

The view is not important for accessibility, nor are any of its descendant views.

static Int

Live region mode specifying that accessibility services should not automatically announce changes to this view.

static Int

Live region mode specifying that accessibility services should announce changes to this view.

static Int

Live region mode specifying that accessibility services should interrupt ongoing speech to immediately announce changes to this view.

static Int

Indicates that the view does not have a layer.

static Int

Indicates that the view has a software layer.

static Int

Indicates that the view has a hardware layer.

static Int

Horizontal layout direction of this view is from Left to Right.

static Int

Horizontal layout direction of this view is from Right to Left.

static Int

Horizontal layout direction of this view is inherited from its parent.

static Int

Horizontal layout direction of this view is from deduced from the default language script for the locale.

static Int

Bits of getMeasuredWidthAndState and getMeasuredWidthAndState that provide the actual measured size.

static Int

Bits of getMeasuredWidthAndState and getMeasuredWidthAndState that provide the additional state bits.

static Int

Bit shift of MEASURED_STATE_MASK to get to the height bits for functions that combine both width and height into a single int, such as getMeasuredState and the childState argument of resolveSizeAndState(int, int, int).

static Int

Bit of getMeasuredWidthAndState and getMeasuredWidthAndState that indicates the measured size is smaller that the space the view would like to have.

static Int

Indicates no axis of view scrolling.

static Int

Indicates scrolling along the horizontal axis.

static Int

Indicates scrolling along the vertical axis.

static Int

Indicates that the input type for the gesture is from a user touching the screen.

static Int

Indicates that the input type for the gesture is caused by something which is not a user touching a screen.

static Int

Scroll indicator direction for the top edge of the view.

static Int

Scroll indicator direction for the bottom edge of the view.

static Int

Scroll indicator direction for the left edge of the view.

static Int

Scroll indicator direction for the right edge of the view.

static Int

Scroll indicator direction for the starting edge of the view.

static Int

Scroll indicator direction for the ending edge of the view.

Protected constructors

Public methods
open static Boolean
canScrollHorizontally(view: View!, direction: Int)

Check if this view can be scrolled horizontally in a certain direction.

open static Boolean
canScrollVertically(view: View!, direction: Int)

Check if this view can be scrolled vertically in a certain direction.

open static Int

Returns the over-scroll mode for this view.

open static Unit
setOverScrollMode(v: View!, overScrollMode: Int)

Set the over-scroll mode for this view.

open static Unit

Called from View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) giving a chance to this View to populate the accessibility event with its text content.

open static Unit

Initializes an AccessibilityEvent with information about this View which is the event source.

open static Unit

Initializes an AccessibilityNodeInfoCompat with information about this view.

open static Unit

Sets a delegate for implementing accessibility support via composition (as opposed to inheritance).

open static Unit
setAutofillHints(@NonNull v: View, @Nullable vararg autofillHints: String!)

Sets the hints that help an android.service.autofill.AutofillService determine how to autofill the view with the user's data.

open static Int

Gets the mode for determining whether this view is important for autofill.

open static Unit
setImportantForAutofill(@NonNull v: View, mode: Int)

Sets the mode for determining whether this view is considered important for autofill.

open static Boolean

Hints the Android System whether the android.app.assist.AssistStructure.ViewNode associated with this view is considered important for autofill purposes.

open static Boolean

Checks whether provided View has an accessibility delegate attached to it.

open static AccessibilityDelegateCompat?

Get the current accessibility delegate.

open static Boolean
hasTransientState(@NonNull view: View)

Indicates whether the view is currently tracking transient state that the app should not need to concern itself with saving and restoring, but that the framework should take special note to preserve when possible.

open static Unit
setHasTransientState(@NonNull view: View, hasTransientState: Boolean)

Set whether this view is currently tracking transient state that the framework should attempt to preserve when possible.

open static Unit

Cause an invalidate to happen on the next animation time step, typically the next display frame.

open static Unit
postInvalidateOnAnimation(@NonNull view: View, left: Int, top: Int, right: Int, bottom: Int)

Cause an invalidate of the specified area to happen on the next animation time step, typically the next display frame.

open static Unit
postOnAnimation(@NonNull view: View, action: Runnable!)

Causes the Runnable to execute on the next animation time step.

open static Unit
postOnAnimationDelayed(@NonNull view: View, action: Runnable!, delayMillis: Long)

Causes the Runnable to execute on the next animation time step, after the specified amount of time elapses.

open static Int

Gets the mode for determining whether this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.

open static Unit
setImportantForAccessibility(@NonNull view: View, mode: Int)

Sets how to determine whether this view is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.

open static Boolean

Computes whether this view should be exposed for accessibility.

open static Boolean
performAccessibilityAction(@NonNull view: View, action: Int, arguments: Bundle!)

Performs the specified accessibility action on the view.

open static Int
addAccessibilityAction(@NonNull view: View, @NonNull label: CharSequence, @NonNull command: AccessibilityViewCommand)

Adds an accessibility action that can be performed on a node associated with a view.

open static Unit
replaceAccessibilityAction(@NonNull view: View, @NonNull replacedAction: AccessibilityNodeInfoCompat.AccessibilityActionCompat, @Nullable label: CharSequence?, @Nullable command: AccessibilityViewCommand?)

Replaces an action.

open static Unit
removeAccessibilityAction(@NonNull view: View, actionId: Int)

Removes an accessibility action that can be performed on a node associated with a view.

open static Unit

Allow accessibility services to find and activate clickable spans in the application.

open static AccessibilityNodeProviderCompat!

Gets the provider for managing a virtual view hierarchy rooted at this View and reported to android.accessibilityservice.AccessibilityServices that explore the window content.

open static Float
getAlpha(view: View!)

The opacity of the view.

open static Unit
setLayerType(view: View!, layerType: Int, paint: Paint!)

Specifies the type of layer backing this view.

open static Int

Indicates what type of layer is currently associated with this view.

open static Int
getLabelFor(@NonNull view: View)

Gets the id of a view for which a given view serves as a label for accessibility purposes.

open static Unit
setLabelFor(@NonNull view: View, @IdRes labeledId: Int)

Sets the id of a view for which a given view serves as a label for accessibility purposes.

open static Unit
setLayerPaint(@NonNull view: View, paint: Paint!)

Updates the Paint object used with the current layer (used only if the current layer type is not set to View#LAYER_TYPE_NONE).

open static Int
getLayoutDirection(@NonNull view: View)

Returns the resolved layout direction for this view.

open static Unit
setLayoutDirection(@NonNull view: View, layoutDirection: Int)

Set the layout direction for this view.

open static ViewParent!

Gets the parent for accessibility purposes.

open static T
requireViewById(@NonNull view: View, @IdRes id: Int)

Finds the first descendant view with the given ID, the view itself if the ID matches View#getId(), or throws an IllegalArgumentException if the ID is invalid or there is no matching view in the hierarchy.

open static Boolean
isOpaque(view: View!)

Indicates whether this View is opaque.

open static Int
resolveSizeAndState(size: Int, measureSpec: Int, childMeasuredState: Int)

Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec.

open static Int

Return the full width measurement information for this view as computed by the most recent call to android.view.View#measure(int, int).

open static Int

Return the full height measurement information for this view as computed by the most recent call to android.view.View#measure(int, int).

open static Int

Return only the state bits of getMeasuredWidthAndState and getMeasuredHeightAndState, combined into one integer.

open static Int
combineMeasuredStates(curState: Int, newState: Int)

Merge two states as returned by getMeasuredState(View).

open static Int

Gets the live region mode for the specified View.

open static Unit
setAccessibilityLiveRegion(@NonNull view: View, mode: Int)

Sets the live region mode for the specified view.

open static Int
getPaddingStart(@NonNull view: View)

Returns the start padding of the specified view depending on its resolved layout direction.

open static Int
getPaddingEnd(@NonNull view: View)

Returns the end padding of the specified view depending on its resolved layout direction.

open static Unit
setPaddingRelative(@NonNull view: View, @Px start: Int, @Px top: Int, @Px end: Int, @Px bottom: Int)

Sets the relative padding.

open static Unit

Notify a view that it is being temporarily detached.

open static Unit

Notify a view that its temporary detach has ended; the view is now reattached.

open static Float

The horizontal location of this view relative to its left position.

open static Float

The vertical location of this view relative to its top position.

open static Matrix?
getMatrix(view: View!)

The transform matrix of this view, which is calculated based on the current rotation, scale, and pivot properties.

open static Int
getMinimumWidth(@NonNull view: View)

Returns the minimum width of the view.

open static Int
getMinimumHeight(@NonNull view: View)

Returns the minimum height of the view.

open static ViewPropertyAnimatorCompat
animate(@NonNull view: View)

This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View.

open static Unit
setTranslationX(view: View!, value: Float)

Sets the horizontal location of this view relative to its left position.

open static Unit
setTranslationY(view: View!, value: Float)

Sets the vertical location of this view relative to its top position.

open static Unit
setAlpha(view: View!, value: Float)

Sets the opacity of the view.

open static Unit
setX(view: View!, value: Float)

Sets the visual x position of this view, in pixels.

open static Unit
setY(view: View!, value: Float)

Sets the visual y position of this view, in pixels.

open static Unit
setRotation(view: View!, value: Float)

Sets the degrees that the view is rotated around the pivot point.

open static Unit
setRotationX(view: View!, value: Float)

Sets the degrees that the view is rotated around the horizontal axis through the pivot point.

open static Unit
setRotationY(view: View!, value: Float)

Sets the degrees that the view is rotated around the vertical axis through the pivot point.

open static Unit
setScaleX(view: View!, value: Float)

Sets the amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width.

open static Unit
setScaleY(view: View!, value: Float)

Sets the amount that the view is scaled in Y around the pivot point, as a proportion of the view's unscaled width.

open static Float
getPivotX(view: View!)

The x location of the point around which the view is rotated and scaled.

open static Unit
setPivotX(view: View!, value: Float)

Sets the x location of the point around which the view is rotated and scaled.

open static Float
getPivotY(view: View!)

The y location of the point around which the view is rotated and scaled.

open static Unit
setPivotY(view: View!, value: Float)

Sets the y location of the point around which the view is rotated and scaled.

open static Float
getRotation(view: View!)

open static Float

open static Float

open static Float
getScaleX(view: View!)

open static Float
getScaleY(view: View!)

open static Float
getX(view: View!)

open static Float
getY(view: View!)

open static Unit
setElevation(@NonNull view: View, elevation: Float)

Sets the base elevation of this view, in pixels.

open static Float
getElevation(@NonNull view: View)

The base elevation of this view relative to its parent, in pixels.

open static Unit
setTranslationZ(@NonNull view: View, translationZ: Float)

Sets the depth location of this view relative to its elevation.

open static Float
getTranslationZ(@NonNull view: View)

The depth location of this view relative to its elevation.

open static Unit
setTransitionName(@NonNull view: View, transitionName: String!)

Sets the name of the View to be used to identify Views in Transitions.

open static String?
getTransitionName(@NonNull view: View)

Returns the name of the View to be used to identify Views in Transitions.

open static Int

Returns the current system UI visibility that is currently set for the entire window.

open static Unit
requestApplyInsets(@NonNull view: View)

Ask that a new dispatch of View.onApplyWindowInsets(WindowInsets) be performed.

open static Unit

Tells the ViewGroup whether to draw its children in the order defined by the method ViewGroup.getChildDrawingOrder(int, int).

open static Boolean

Returns true if this view should adapt to fit system window insets.

open static Unit
setFitsSystemWindows(view: View!, fitSystemWindows: Boolean)

Sets whether or not this view should account for system screen decorations such as the status bar and inset its content; that is, controlling whether the default implementation of View#fitSystemWindows(Rect) will be executed.

open static Unit

On API 11 devices and above, call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.

open static Unit

Set an OnApplyWindowInsetsListener to take over the policy for applying window insets to this view.

open static WindowInsetsCompat!
onApplyWindowInsets(@NonNull view: View, insets: WindowInsetsCompat!)

Called when the view should apply WindowInsetsCompat according to its internal policy.

open static WindowInsetsCompat!

Request to apply the given window insets to this view or another view in its subtree.

open static Unit

Controls whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent.

open static Unit
setActivated(view: View!, activated: Boolean)

Changes the activated state of this view.

open static Boolean
hasOverlappingRendering(@NonNull view: View)

Returns whether this View has content which overlaps.

open static Boolean
isPaddingRelative(@NonNull view: View)

Return if the padding as been set through relative values View.setPaddingRelative(int, int, int, int) or thru

open static Unit
setBackground(@NonNull view: View, @Nullable background: Drawable?)

Set the background of the view to a given Drawable, or remove the background.

open static ColorStateList!
getBackgroundTintList(@NonNull view: View)

Return the tint applied to the background drawable, if specified.

open static Unit
setBackgroundTintList(@NonNull view: View, tintList: ColorStateList!)

Applies a tint to the background drawable.

open static Mode!
getBackgroundTintMode(@NonNull view: View)

Return the blending mode used to apply the tint to the background drawable, if specified.

open static Unit
setBackgroundTintMode(@NonNull view: View, mode: Mode!)

Specifies the blending mode used to apply the tint specified by setBackgroundTintList(android.view.View, android.content.res.ColorStateList) to the background drawable.

open static Unit
setNestedScrollingEnabled(@NonNull view: View, enabled: Boolean)

Enable or disable nested scrolling for this view.

open static Boolean

Returns true if nested scrolling is enabled for this view.

open static Boolean
startNestedScroll(@NonNull view: View, axes: Int)

Begin a nestable scroll operation along the given axes.

open static Boolean
startNestedScroll(@NonNull view: View, axes: Int, type: Int)

Begin a nestable scroll operation along the given axes.

open static Unit
stopNestedScroll(@NonNull view: View)

Stop a nested scroll in progress.

open static Unit
stopNestedScroll(@NonNull view: View, type: Int)

Stop a nested scroll in progress.

open static Boolean

Returns true if this view has a nested scrolling parent.

open static Boolean
hasNestedScrollingParent(@NonNull view: View, type: Int)

Returns true if this view has a nested scrolling parent.

open static Boolean
dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: IntArray?)

Dispatch one step of a nested scroll in progress.

open static Unit
dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: IntArray?, type: Int, @NonNull consumed: IntArray)

Dispatch one step of a nested scroll in progress.

open static Boolean
dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: IntArray?, type: Int)

Dispatch one step of a nested scroll in progress.

open static Boolean
dispatchNestedPreScroll(@NonNull view: View, dx: Int, dy: Int, @Nullable consumed: IntArray?, @Nullable offsetInWindow: IntArray?)

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

open static Boolean
dispatchNestedPreScroll(@NonNull view: View, dx: Int, dy: Int, @Nullable consumed: IntArray?, @Nullable offsetInWindow: IntArray?, type: Int)

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

open static Boolean
dispatchNestedFling(@NonNull view: View, velocityX: Float, velocityY: Float, consumed: Boolean)

Dispatch a fling to a nested scrolling parent.

open static Boolean
dispatchNestedPreFling(@NonNull view: View, velocityX: Float, velocityY: Float)

Dispatch a fling to a nested scrolling parent before it is processed by this view.

open static Boolean
isInLayout(@NonNull view: View)

Returns whether the view hierarchy is currently undergoing a layout pass.

open static Boolean
isLaidOut(@NonNull view: View)

Returns true if view has been through at least one layout since it was last attached to or detached from a window.

open static Boolean

Returns whether layout direction has been resolved.

open static Float
getZ(@NonNull view: View)

The visual z position of this view, in pixels.

open static Unit
setZ(@NonNull view: View, z: Float)

Sets the visual z position of this view, in pixels.

open static Unit
offsetTopAndBottom(@NonNull view: View, offset: Int)

Offset this view's vertical location by the specified number of pixels.

open static Unit
offsetLeftAndRight(@NonNull view: View, offset: Int)

Offset this view's horizontal location by the specified amount of pixels.

open static Unit
setClipBounds(@NonNull view: View, clipBounds: Rect!)

Sets a rectangular area on this view to which the view will be clipped when it is drawn.

open static Rect?
getClipBounds(@NonNull view: View)

Returns a copy of the current setClipBounds(View, Rect).

open static Boolean
isAttachedToWindow(@NonNull view: View)

Returns true if the provided view is currently attached to a window.

open static Boolean
hasOnClickListeners(@NonNull view: View)

Returns whether the provided view has an attached View.OnClickListener.

open static Unit
setScrollIndicators(@NonNull view: View, indicators: Int)

Sets the state of all scroll indicators.

open static Unit
setScrollIndicators(@NonNull view: View, indicators: Int, mask: Int)

Sets the state of the scroll indicators specified by the mask.

open static Int
getScrollIndicators(@NonNull view: View)

Returns a bitmask representing the enabled scroll indicators.

open static Unit
setPointerIcon(@NonNull view: View, pointerIcon: PointerIconCompat!)

Set the pointer icon for the current view.

open static Display?
getDisplay(@NonNull view: View)

Gets the logical display to which the view's window has been attached.

open static Unit
setTooltipText(@NonNull view: View, @Nullable tooltipText: CharSequence?)

Sets the tooltip for the view.

open static Boolean
startDragAndDrop(@NonNull v: View, data: ClipData!, shadowBuilder: DragShadowBuilder!, localState: Any!, flags: Int)

Start the drag and drop operation.

open static Unit
cancelDragAndDrop(@NonNull v: View)

Cancel the drag and drop operation.

open static Unit
updateDragShadow(@NonNull v: View, shadowBuilder: DragShadowBuilder!)

Update the drag shadow while drag and drop is in progress.

open static Int
getNextClusterForwardId(@NonNull view: View)

Gets the ID of the next keyboard navigation cluster root.

open static Unit
setNextClusterForwardId(@NonNull view: View, nextClusterForwardId: Int)

Sets the ID of the next keyboard navigation cluster root view.

open static Boolean

Returns whether view is a root of a keyboard navigation cluster.

open static Unit
setKeyboardNavigationCluster(@NonNull view: View, isCluster: Boolean)

Set whether view is a root of a keyboard navigation cluster.

open static Boolean
isFocusedByDefault(@NonNull view: View)

Returns whether view should receive focus when the focus is restored for the view hierarchy containing it.

open static Unit
setFocusedByDefault(@NonNull view: View, isFocusedByDefault: Boolean)

Sets whether view should receive focus when the focus is restored for the view hierarchy containing it.

open static View!
keyboardNavigationClusterSearch(@NonNull view: View, currentCluster: View!, direction: Int)

Find the nearest keyboard navigation cluster in the specified direction.

open static Unit
addKeyboardNavigationClusters(@NonNull view: View, @NonNull views: MutableCollection<View!>, direction: Int)

Adds any keyboard navigation cluster roots that are descendants of view ( including view if it is a cluster root itself) to views.

open static Boolean
restoreDefaultFocus(@NonNull view: View)

Gives focus to the default-focus view in the view hierarchy rooted at view.

open static Boolean
hasExplicitFocusable(@NonNull view: View)

Returns true if this view is focusable or if it contains a reachable View for which View#hasExplicitFocusable() returns true.

open static Int

Generate a value suitable for use in View#setId(int).

open static Unit

Adds a listener which will receive unhandled KeyEvents.

open static Unit

Removes a listener which will receive unhandled KeyEvents.

open static Unit
setScreenReaderFocusable(view: View!, screenReaderFocusable: Boolean)

When screen readers (one type of accessibility tool) decide what should be read to the user, they typically look for input focusable (View#isFocusable()) parents of non-focusable text items, and read those focusable parents and their non-focusable children as a unit.

open static Boolean

Returns whether the view should be treated as a focusable unit by screen reader accessibility tools.

open static Unit
setAccessibilityPaneTitle(view: View!, accessibilityPaneTitle: CharSequence!)

Visually distinct portion of a window with window-like semantics are considered panes for accessibility purposes.

open static CharSequence!

Get the title of the pane for purposes of accessibility.

open static Boolean

Gets whether this view is a heading for accessibility purposes.

open static Unit
setAccessibilityHeading(view: View!, isHeading: Boolean)

Set if view is a heading for a section of content for accessibility purposes.

Constants

OVER_SCROLL_ALWAYS

static val OVER_SCROLL_ALWAYS: Int

Always allow a user to over-scroll this view, provided it is a view that can scroll.

Value: 0

OVER_SCROLL_IF_CONTENT_SCROLLS

static val OVER_SCROLL_IF_CONTENT_SCROLLS: Int

Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll.

Value: 1

OVER_SCROLL_NEVER

static val OVER_SCROLL_NEVER: Int

Never allow a user to over-scroll this view.

Value: 2

IMPORTANT_FOR_ACCESSIBILITY_AUTO

static val IMPORTANT_FOR_ACCESSIBILITY_AUTO: Int

Automatically determine whether a view is important for accessibility.

Value: 0x00000000

IMPORTANT_FOR_ACCESSIBILITY_YES

static val IMPORTANT_FOR_ACCESSIBILITY_YES: Int

The view is important for accessibility.

Value: 0x00000001

IMPORTANT_FOR_ACCESSIBILITY_NO

static val IMPORTANT_FOR_ACCESSIBILITY_NO: Int

The view is not important for accessibility.

Value: 0x00000002

IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS

static val IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS: Int

The view is not important for accessibility, nor are any of its descendant views.

Value: 0x00000004

ACCESSIBILITY_LIVE_REGION_NONE

static val ACCESSIBILITY_LIVE_REGION_NONE: Int

Live region mode specifying that accessibility services should not automatically announce changes to this view. This is the default live region mode for most views.

Use with ViewCompat#setAccessibilityLiveRegion(View, int).

Value: 0x00000000

ACCESSIBILITY_LIVE_REGION_POLITE

static val ACCESSIBILITY_LIVE_REGION_POLITE: Int

Live region mode specifying that accessibility services should announce changes to this view.

Use with ViewCompat#setAccessibilityLiveRegion(View, int).

Value: 0x00000001

ACCESSIBILITY_LIVE_REGION_ASSERTIVE

static val ACCESSIBILITY_LIVE_REGION_ASSERTIVE: Int

Live region mode specifying that accessibility services should interrupt ongoing speech to immediately announce changes to this view.

Use with ViewCompat#setAccessibilityLiveRegion(View, int).

Value: 0x00000002

LAYER_TYPE_NONE

static val LAYER_TYPE_NONE: Int

Indicates that the view does not have a layer.

Value: 0

LAYER_TYPE_SOFTWARE

static val LAYER_TYPE_SOFTWARE: Int

Indicates that the view has a software layer. A software layer is backed by a bitmap and causes the view to be rendered using Android's software rendering pipeline, even if hardware acceleration is enabled.

Software layers have various usages:

When the application is not using hardware acceleration, a software layer is useful to apply a specific color filter and/or blending mode and/or translucency to a view and all its children.

When the application is using hardware acceleration, a software layer is useful to render drawing primitives not supported by the hardware accelerated pipeline. It can also be used to cache a complex view tree into a texture and reduce the complexity of drawing operations. For instance, when animating a complex view tree with a translation, a software layer can be used to render the view tree only once.

Software layers should be avoided when the affected view tree updates often. Every update will require to re-render the software layer, which can potentially be slow (particularly when hardware acceleration is turned on since the layer will have to be uploaded into a hardware texture after every update.)

Value: 1

LAYER_TYPE_HARDWARE

static val LAYER_TYPE_HARDWARE: Int

Indicates that the view has a hardware layer. A hardware layer is backed by a hardware specific texture (generally Frame Buffer Objects or FBO on OpenGL hardware) and causes the view to be rendered using Android's hardware rendering pipeline, but only if hardware acceleration is turned on for the view hierarchy. When hardware acceleration is turned off, hardware layers behave exactly as software layers.

A hardware layer is useful to apply a specific color filter and/or blending mode and/or translucency to a view and all its children.

A hardware layer can be used to cache a complex view tree into a texture and reduce the complexity of drawing operations. For instance, when animating a complex view tree with a translation, a hardware layer can be used to render the view tree only once.

A hardware layer can also be used to increase the rendering quality when rotation transformations are applied on a view. It can also be used to prevent potential clipping issues when applying 3D transforms on a view.

Value: 2

LAYOUT_DIRECTION_LTR

static val LAYOUT_DIRECTION_LTR: Int

Horizontal layout direction of this view is from Left to Right.

Value: 0

LAYOUT_DIRECTION_RTL

static val LAYOUT_DIRECTION_RTL: Int

Horizontal layout direction of this view is from Right to Left.

Value: 1

LAYOUT_DIRECTION_INHERIT

static val LAYOUT_DIRECTION_INHERIT: Int

Horizontal layout direction of this view is inherited from its parent. Use with setLayoutDirection.

Value: 2

LAYOUT_DIRECTION_LOCALE

static val LAYOUT_DIRECTION_LOCALE: Int

Horizontal layout direction of this view is from deduced from the default language script for the locale. Use with setLayoutDirection.

Value: 3

MEASURED_SIZE_MASK

static val MEASURED_SIZE_MASK: Int

Bits of getMeasuredWidthAndState and getMeasuredWidthAndState that provide the actual measured size.

Value: 0x00ffffff

MEASURED_STATE_MASK

static val MEASURED_STATE_MASK: Int

Bits of getMeasuredWidthAndState and getMeasuredWidthAndState that provide the additional state bits.

Value: 0xff000000

MEASURED_HEIGHT_STATE_SHIFT

static val MEASURED_HEIGHT_STATE_SHIFT: Int

Bit shift of MEASURED_STATE_MASK to get to the height bits for functions that combine both width and height into a single int, such as getMeasuredState and the childState argument of resolveSizeAndState(int, int, int).

Value: 16

MEASURED_STATE_TOO_SMALL

static val MEASURED_STATE_TOO_SMALL: Int

Bit of getMeasuredWidthAndState and getMeasuredWidthAndState that indicates the measured size is smaller that the space the view would like to have.

Value: 0x01000000

SCROLL_AXIS_NONE

static val SCROLL_AXIS_NONE: Int

Indicates no axis of view scrolling.

Value: 0

SCROLL_AXIS_HORIZONTAL

static val SCROLL_AXIS_HORIZONTAL: Int

Indicates scrolling along the horizontal axis.

Value: 1 << 0

SCROLL_AXIS_VERTICAL

static val SCROLL_AXIS_VERTICAL: Int

Indicates scrolling along the vertical axis.

Value: 1 << 1

TYPE_TOUCH

static val TYPE_TOUCH: Int

Indicates that the input type for the gesture is from a user touching the screen.

Value: 0

TYPE_NON_TOUCH

static val TYPE_NON_TOUCH: Int

Indicates that the input type for the gesture is caused by something which is not a user touching a screen. This is usually from a fling which is settling.

Value: 1

SCROLL_INDICATOR_TOP

static val SCROLL_INDICATOR_TOP: Int

Scroll indicator direction for the top edge of the view.

Value: 0x1

SCROLL_INDICATOR_BOTTOM

static val SCROLL_INDICATOR_BOTTOM: Int

Scroll indicator direction for the bottom edge of the view.

Value: 0x2

SCROLL_INDICATOR_LEFT

static val SCROLL_INDICATOR_LEFT: Int

Scroll indicator direction for the left edge of the view.

Value: 0x4

SCROLL_INDICATOR_RIGHT

static val SCROLL_INDICATOR_RIGHT: Int

Scroll indicator direction for the right edge of the view.

Value: 0x8

SCROLL_INDICATOR_START

static val SCROLL_INDICATOR_START: Int

Scroll indicator direction for the starting edge of the view.

Value: 0x10

SCROLL_INDICATOR_END

static val SCROLL_INDICATOR_END: Int

Scroll indicator direction for the ending edge of the view.

Value: 0x20

Protected constructors

<init>

protected ViewCompat()

Public methods

canScrollHorizontally

open static fun canScrollHorizontally(view: View!, direction: Int): Boolean

Check if this view can be scrolled horizontally in a certain direction.

Parameters
view View!: The View against which to invoke the method.
direction View!: Negative to check scrolling left, positive to check scrolling right.
Return
Boolean: true if this view can be scrolled in the specified direction, false otherwise.

canScrollVertically

open static fun canScrollVertically(view: View!, direction: Int): Boolean

Check if this view can be scrolled vertically in a certain direction.

Parameters
view View!: The View against which to invoke the method.
direction View!: Negative to check scrolling up, positive to check scrolling down.
Return
Boolean: true if this view can be scrolled in the specified direction, false otherwise.

getOverScrollMode

open static fun getOverScrollMode(v: View!): Int

Returns the over-scroll mode for this view. The result will be one of OVER_SCROLL_ALWAYS (default), OVER_SCROLL_IF_CONTENT_SCROLLS (allow over-scrolling only if the view content is larger than the container), or OVER_SCROLL_NEVER.

Parameters
v View!: The View against which to invoke the method.
Return
Int: This view's over-scroll mode.

setOverScrollMode

open static fun setOverScrollMode(v: View!, overScrollMode: Int): Unit

Set the over-scroll mode for this view. Valid over-scroll modes are OVER_SCROLL_ALWAYS (default), OVER_SCROLL_IF_CONTENT_SCROLLS (allow over-scrolling only if the view content is larger than the container), or OVER_SCROLL_NEVER. Setting the over-scroll mode of a view will have an effect only if the view is capable of scrolling.

Parameters
v View!: The View against which to invoke the method.
overScrollMode View!: The new over-scroll mode for this view.

onPopulateAccessibilityEvent

open static fun onPopulateAccessibilityEvent(v: View!, event: AccessibilityEvent!): Unit

Called from View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) giving a chance to this View to populate the accessibility event with its text content. While this method is free to modify event attributes other than text content, doing so should normally be performed in View#onInitializeAccessibilityEvent(AccessibilityEvent).

Example: Adding formatted date string to an accessibility event in addition to the text added by the super implementation:

 public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY; String selectedDateUtterance = DateUtils.formatDateTime(mContext, mCurrentDate.getTimeInMillis(), flags); event.getText().add(selectedDateUtterance); }

If an AccessibilityDelegateCompat has been specified via calling ViewCompat#setAccessibilityDelegate(View, AccessibilityDelegateCompat) its AccessibilityDelegateCompat#onPopulateAccessibilityEvent(View, AccessibilityEvent) is responsible for handling this call.

Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.

Parameters
v View!: The View against which to invoke the method.
event View!: The accessibility event which to populate.

onInitializeAccessibilityEvent

open static fun onInitializeAccessibilityEvent(v: View!, event: AccessibilityEvent!): Unit

Initializes an AccessibilityEvent with information about this View which is the event source. In other words, the source of an accessibility event is the view whose state change triggered firing the event.

Example: Setting the password property of an event in addition to properties set by the super implementation:

 public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setPassword(true); }

If an AccessibilityDelegateCompat has been specified via calling ViewCompat#setAccessibilityDelegate(View, AccessibilityDelegateCompat), its AccessibilityDelegateCompat#onInitializeAccessibilityEvent(View, AccessibilityEvent) is responsible for handling this call.

Parameters
v View!: The View against which to invoke the method.
event View!: The event to initialize.

setAccessibilityDelegate

open static fun setAccessibilityDelegate(@NonNull v: View, delegate: AccessibilityDelegateCompat!): Unit

Sets a delegate for implementing accessibility support via composition (as opposed to inheritance). For more details, see AccessibilityDelegateCompat.

Note: On platform versions prior to API 23, delegate methods on views in the android.widget.* package are called before host methods. This prevents certain properties such as class name from being modified by overriding AccessibilityDelegateCompat#onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat), as any changes will be overwritten by the host class.

Starting in API 23, delegate methods are called after host methods, which all properties to be modified without being overwritten by the host class.

If an AccessibilityDelegateCompat is already attached to the view, and this method sets the delegate to null, an empty delegate will be attached to ensure that other compatibility behavior continues to work for this view.

Parameters
delegate View: the object to which accessibility method calls should be delegated

setAutofillHints

open static fun setAutofillHints(@NonNull v: View, @Nullable vararg autofillHints: String!): Unit

Sets the hints that help an android.service.autofill.AutofillService determine how to autofill the view with the user's data.

Typically, there is only one way to autofill a view, but there could be more than one. For example, if the application accepts either an username or email address to identify an user.

These hints are not validated by the Android System, but passed "as is" to the service. Hence, they can have any value, but it's recommended to use the AUTOFILL_HINT_ constants such as: View#AUTOFILL_HINT_USERNAME, View#AUTOFILL_HINT_PASSWORD, View#AUTOFILL_HINT_EMAIL_ADDRESS, View#AUTOFILL_HINT_NAME, View#AUTOFILL_HINT_PHONE, View#AUTOFILL_HINT_POSTAL_ADDRESS, View#AUTOFILL_HINT_POSTAL_CODE, View#AUTOFILL_HINT_CREDIT_CARD_NUMBER, View#AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, View#AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, View#AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, View#AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH or View#AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR.

This method is only supported on API >= 26. On API 25 and below, it is a no-op

Parameters
autofillHints View: The autofill hints to set. If the array is emtpy, null is set. android.R.attr#autofillHints

getImportantForAutofill

open static fun getImportantForAutofill(@NonNull v: View): Int

Gets the mode for determining whether this view is important for autofill.

See setImportantForAutofill(View, int) and isImportantForAutofill(View) for more info about this mode.

This method is only supported on API >= 26. On API 25 and below, it will always return View#IMPORTANT_FOR_AUTOFILL_AUTO.

Return
Int: View#IMPORTANT_FOR_AUTOFILL_AUTO by default, or value passed to setImportantForAutofill(View, int). android.R.attr#importantForAutofill

setImportantForAutofill

open static fun setImportantForAutofill(@NonNull v: View, mode: Int): Unit

Sets the mode for determining whether this view is considered important for autofill.

The platform determines the importance for autofill automatically but you can use this method to customize the behavior. For example:

  1. When the view contents is irrelevant for autofill (for example, a text field used in a "Captcha" challenge), it should be View#IMPORTANT_FOR_AUTOFILL_NO.
  2. When both the view and its children are irrelevant for autofill (for example, the root view of an activity containing a spreadhseet editor), it should be View#IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS.
  3. When the view content is relevant for autofill but its children aren't (for example, a credit card expiration date represented by a custom view that overrides the proper autofill methods and has 2 children representing the month and year), it should be View#IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS.

NOTE: setting the mode as does View#IMPORTANT_FOR_AUTOFILL_NO or View#IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS does not guarantee the view (and its children) will be always be considered not important; for example, when the user explicitly makes an autofill request, all views are considered important. See isImportantForAutofill(View) for more details about how the View's importance for autofill is used.

This method is only supported on API >= 26. On API 25 and below, it is a no-op

Parameters
mode View: View#IMPORTANT_FOR_AUTOFILL_AUTO, View#IMPORTANT_FOR_AUTOFILL_YES, View#IMPORTANT_FOR_AUTOFILL_NO, View#IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, or View#IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS. android.R.attr#importantForAutofill

isImportantForAutofill

open static fun isImportantForAutofill(@NonNull v: View): Boolean

Hints the Android System whether the android.app.assist.AssistStructure.ViewNode associated with this view is considered important for autofill purposes.

Generally speaking, a view is important for autofill if:

  1. The view can be autofilled by an android.service.autofill.AutofillService.
  2. The view contents can help an android.service.autofill.AutofillService determine how other views can be autofilled.

      For example, view containers should typically return false for performance reasons (since the important info is provided by their children), but if its properties have relevant information (for example, a resource id called credentials, it should return true. On the other hand, views representing labels or editable fields should typically return true, but in some cases they could return false (for example, if they're part of a "Captcha" mechanism).

      The value returned by this method depends on the value returned by getImportantForAutofill(View):

      1. if it returns View#IMPORTANT_FOR_AUTOFILL_YES or View#IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, then it returns true
      2. if it returns View#IMPORTANT_FOR_AUTOFILL_NO or View#IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, then it returns false
      3. if it returns View#IMPORTANT_FOR_AUTOFILL_AUTO, then it uses some simple heuristics that can return true in some cases (like a container with a resource id), but false in most.
      4. otherwise, it returns false.

      When a view is considered important for autofill:

      • The view might automatically trigger an autofill request when focused on.
      • The contents of the view are included in the android.view.ViewStructure used in an autofill request.

      On the other hand, when a view is considered not important for autofill:

      This method is only supported on API >= 26. On API 25 and below, it will always return true.

Return
Boolean: whether the view is considered important for autofill.

hasAccessibilityDelegate

open static fun hasAccessibilityDelegate(@NonNull view: View): Boolean

Checks whether provided View has an accessibility delegate attached to it.

Parameters
view View: The View instance to check
Return
Boolean: True if the View has an accessibility delegate

getAccessibilityDelegate

@Nullable open static fun getAccessibilityDelegate(@NonNull view: View): AccessibilityDelegateCompat?

Get the current accessibility delegate.

Parameters
view View: The view whose delegate is of interest
Return
AccessibilityDelegateCompat?: A compat wrapper for the current delegate. If no delegate is attached, you may still get an object that is being used to provide backward compatibility. Returns null if there is no delegate attached.

hasTransientState

open static fun hasTransientState(@NonNull view: View): Boolean

Indicates whether the view is currently tracking transient state that the app should not need to concern itself with saving and restoring, but that the framework should take special note to preserve when possible.

Parameters
view View: View to check for transient state
Return
Boolean: true if the view has transient state

setHasTransientState

open static fun setHasTransientState(@NonNull view: View, hasTransientState: Boolean): Unit

Set whether this view is currently tracking transient state that the framework should attempt to preserve when possible.

Parameters
view View: View tracking transient state
hasTransientState View: true if this view has transient state

postInvalidateOnAnimation

open static fun postInvalidateOnAnimation(@NonNull view: View): Unit

Cause an invalidate to happen on the next animation time step, typically the next display frame.

This method can be invoked from outside of the UI thread only when this View is attached to a window.

Parameters
view View: View to invalidate

postInvalidateOnAnimation

open static fun postInvalidateOnAnimation(@NonNull view: View, left: Int, top: Int, right: Int, bottom: Int): Unit

Cause an invalidate of the specified area to happen on the next animation time step, typically the next display frame.

This method can be invoked from outside of the UI thread only when this View is attached to a window.

Parameters
view View: View to invalidate
left View: The left coordinate of the rectangle to invalidate.
top View: The top coordinate of the rectangle to invalidate.
right View: The right coordinate of the rectangle to invalidate.
bottom View: The bottom coordinate of the rectangle to invalidate.

postOnAnimation

open static fun postOnAnimation(@NonNull view: View, action: Runnable!): Unit

Causes the Runnable to execute on the next animation time step. The runnable will be run on the user interface thread.

This method can be invoked from outside of the UI thread only when this View is attached to a window.

Parameters
view View: View to post this Runnable to
action View: The Runnable that will be executed.

postOnAnimationDelayed

open static fun postOnAnimationDelayed(@NonNull view: View, action: Runnable!, delayMillis: Long): Unit

Causes the Runnable to execute on the next animation time step, after the specified amount of time elapses. The runnable will be run on the user interface thread.

This method can be invoked from outside of the UI thread only when this View is attached to a window.

Parameters
view View: The view to post this Runnable to
action View: The Runnable that will be executed.
delayMillis View: The delay (in milliseconds) until the Runnable will be executed.

getImportantForAccessibility

open static fun getImportantForAccessibility(@NonNull view: View): Int

Gets the mode for determining whether this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.

Parameters
view View: The view whose property to get.
Return
Int: The mode for determining whether a View is important for accessibility.

setImportantForAccessibility

open static fun setImportantForAccessibility(@NonNull view: View, mode: Int): Unit

Sets how to determine whether this view is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.

Note: If the current platform version does not support the IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS mode, then IMPORTANT_FOR_ACCESSIBILITY_NO will be used as it is the closest terms of semantics.

Parameters
view View: The view whose property to set.
mode View: How to determine whether this view is important for accessibility.

isImportantForAccessibility

open static fun isImportantForAccessibility(@NonNull view: View): Boolean

Computes whether this view should be exposed for accessibility. In general, views that are interactive or provide information are exposed while views that serve only as containers are hidden.

If an ancestor of this view has importance IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, this method returns false.

Otherwise, the value is computed according to the view's getImportantForAccessibility(View) value:

  1. IMPORTANT_FOR_ACCESSIBILITY_NO or IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, return false
  2. IMPORTANT_FOR_ACCESSIBILITY_YES, return true
  3. IMPORTANT_FOR_ACCESSIBILITY_AUTO, return true if view satisfies any of the following:

Note: Prior to API 21, this method will always return true.

Return
Boolean: Whether the view is exposed for accessibility.

performAccessibilityAction

open static fun performAccessibilityAction(@NonNull view: View, action: Int, arguments: Bundle!): Boolean

Performs the specified accessibility action on the view. For possible accessibility actions look at AccessibilityNodeInfoCompat.

If an AccessibilityDelegateCompat has been specified via calling setAccessibilityDelegate(View, AccessibilityDelegateCompat) its AccessibilityDelegateCompat#performAccessibilityAction(View, int, Bundle) is responsible for handling this call.

Parameters
action View: The action to perform.
arguments View: Optional action arguments.
Return
Boolean: Whether the action was performed.

addAccessibilityAction

open static fun addAccessibilityAction(@NonNull view: View, @NonNull label: CharSequence, @NonNull command: AccessibilityViewCommand): Int

Adds an accessibility action that can be performed on a node associated with a view. A view can only have 32 actions created with this API.

Parameters
view View: The view.
label View: The use facing description of the action.
command View: The command performed when the service requests the action.
Return
Int: The id associated with the action, or View#NO_ID if the action could not be created. This id can be used to remove the action.

Compatibility:

  • API < 21: No-op

replaceAccessibilityAction

open static fun replaceAccessibilityAction(@NonNull view: View, @NonNull replacedAction: AccessibilityNodeInfoCompat.AccessibilityActionCompat, @Nullable label: CharSequence?, @Nullable command: AccessibilityViewCommand?): Unit

Replaces an action. This can be used to change the default behavior or label of the action specified.

Parameters
view View: The view.
replacedAction View: The action to be replaced.
label View: The user facing description of the action or null.
command View: The command performed when the service requests the action.

Compatibility:

  • API < 21: No-op

removeAccessibilityAction

open static fun removeAccessibilityAction(@NonNull view: View, actionId: Int): Unit

Removes an accessibility action that can be performed on a node associated with a view. If the action was not already added to the view, calling this method has no effect.

Parameters
view View: The view
actionId View: The actionId of the action to be removed.

enableAccessibleClickableSpanSupport

open static fun enableAccessibleClickableSpanSupport(view: View!): Unit

Allow accessibility services to find and activate clickable spans in the application.

Parameters
view View!: The view

Compatibility:

  • API < 19: No-op

getAccessibilityNodeProvider

open static fun getAccessibilityNodeProvider(@NonNull view: View): AccessibilityNodeProviderCompat!

Gets the provider for managing a virtual view hierarchy rooted at this View and reported to android.accessibilityservice.AccessibilityServices that explore the window content.

If this method returns an instance, this instance is responsible for managing AccessibilityNodeInfoCompats describing the virtual sub-tree rooted at this View including the one representing the View itself. Similarly the returned instance is responsible for performing accessibility actions on any virtual view or the root view itself.

If an AccessibilityDelegateCompat has been specified via calling setAccessibilityDelegate(View, AccessibilityDelegateCompat) its AccessibilityDelegateCompat#getAccessibilityNodeProvider(View) is responsible for handling this call.

Parameters
view View: The view whose property to get.
Return
AccessibilityNodeProviderCompat!: The provider.

getAlpha

open static fun getAlpha(view: View!): Float

The opacity of the view. This is a value from 0 to 1, where 0 means the view is completely transparent and 1 means the view is completely opaque.

By default this is 1.0f.

Return
Float: The opacity of the view.

setLayerType

open static fun setLayerType(view: View!, layerType: Int, paint: Paint!): Unit

Specifies the type of layer backing this view. The layer can be disabled, software or hardware.

A layer is associated with an optional android.graphics.Paint instance that controls how the layer is composed on screen. The following properties of the paint are taken into account when composing the layer:

If this view has an alpha value set to < 1.0 by calling setAlpha(float), the alpha value of the layer's paint is replaced by this view's alpha value. Calling setAlpha(float) is therefore equivalent to setting a hardware layer on this view and providing a paint with the desired alpha value.

Refer to the documentation of disabled, software and hardware for more information on when and how to use layers.

Parameters
view View!: View to set the layer type for
layerType View!: The type of layer to use with this view, must be one of View#LAYER_TYPE_NONE, View#LAYER_TYPE_SOFTWARE or View#LAYER_TYPE_HARDWARE
paint View!: The paint used to compose the layer. This argument is optional and can be null. It is ignored when the layer type is View#LAYER_TYPE_NONE

getLayerType

open static fun getLayerType(view: View!): Int

Indicates what type of layer is currently associated with this view. By default a view does not have a layer, and the layer type is View#LAYER_TYPE_NONE. Refer to the documentation of setLayerType(android.view.View, int, android.graphics.Paint) for more information on the different types of layers.

Parameters
view View!: The view to fetch the layer type from
Return
Int: View#LAYER_TYPE_NONE, View#LAYER_TYPE_SOFTWARE or View#LAYER_TYPE_HARDWARE

getLabelFor

open static fun getLabelFor(@NonNull view: View): Int

Gets the id of a view for which a given view serves as a label for accessibility purposes.

Parameters
view View: The view on which to invoke the corresponding method.
Return
Int: The labeled view id.

setLabelFor

open static fun setLabelFor(@NonNull view: View, @IdRes labeledId: Int): Unit

Sets the id of a view for which a given view serves as a label for accessibility purposes.

Parameters
view View: The view on which to invoke the corresponding method.
labeledId View: The labeled view id.

setLayerPaint

open static fun setLayerPaint(@NonNull view: View, paint: Paint!): Unit

Updates the Paint object used with the current layer (used only if the current layer type is not set to View#LAYER_TYPE_NONE). Changed properties of the Paint provided to setLayerType(android.view.View, int, android.graphics.Paint) will be used the next time the View is redrawn, but setLayerPaint(android.view.View, android.graphics.Paint) must be called to ensure that the view gets redrawn immediately.

A layer is associated with an optional android.graphics.Paint instance that controls how the layer is composed on screen. The following properties of the paint are taken into account when composing the layer:

If this view has an alpha value set to < 1.0 by calling View#setAlpha(float), the alpha value of the layer's paint is replaced by this view's alpha value. Calling View#setAlpha(float) is therefore equivalent to setting a hardware layer on this view and providing a paint with the desired alpha value.

Parameters
view View: View to set a layer paint for
paint View: The paint used to compose the layer. This argument is optional and can be null. It is ignored when the layer type is View#LAYER_TYPE_NONE

getLayoutDirection

open static fun getLayoutDirection(@NonNull view: View): Int

Returns the resolved layout direction for this view.

Parameters
view View: View to get layout direction for
Return
Int: LAYOUT_DIRECTION_RTL if the layout direction is RTL or returns LAYOUT_DIRECTION_LTR if the layout direction is not RTL. For compatibility, this will return LAYOUT_DIRECTION_LTR if API version is lower than Jellybean MR1 (API 17)

setLayoutDirection

open static fun setLayoutDirection(@NonNull view: View, layoutDirection: Int): Unit

Set the layout direction for this view. This will propagate a reset of layout direction resolution to the view's children and resolve layout direction for this view.

Parameters
view View: View to set layout direction for
layoutDirection View: the layout direction to set. Should be one of: LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE. Resolution will be done if the value is set to LAYOUT_DIRECTION_INHERIT. The resolution proceeds up the parent chain of the view to get the value. If there is no parent, then it will return the default LAYOUT_DIRECTION_LTR.

getParentForAccessibility

open static fun getParentForAccessibility(@NonNull view: View): ViewParent!

Gets the parent for accessibility purposes. Note that the parent for accessibility is not necessary the immediate parent. It is the first predecessor that is important for accessibility.

Parameters
view View: View to retrieve parent for
Return
ViewParent!: The parent for use in accessibility inspection

requireViewById

@NonNull open static fun <T : View!> requireViewById(@NonNull view: View, @IdRes id: Int): T

Finds the first descendant view with the given ID, the view itself if the ID matches View#getId(), or throws an IllegalArgumentException if the ID is invalid or there is no matching view in the hierarchy.

Note: In most cases -- depending on compiler support -- the resulting view is automatically cast to the target class type. If the target class type is unconstrained, an explicit cast may be necessary.

Parameters
id View: the ID to search for
Return
T: a view with given ID

isOpaque

open static fun isOpaque(view: View!): Boolean

Indicates whether this View is opaque. An opaque View guarantees that it will draw all the pixels overlapping its bounds using a fully opaque color.

Return
Boolean: True if this View is guaranteed to be fully opaque, false otherwise.

resolveSizeAndState

open static fun resolveSizeAndState(size: Int, measureSpec: Int, childMeasuredState: Int): Int

Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec. Will take the desired size, unless a different size is imposed by the constraints. The returned value is a compound integer, with the resolved size in the MEASURED_SIZE_MASK bits and optionally the bit MEASURED_STATE_TOO_SMALL set if the resulting size is smaller than the size the view wants to be.

Parameters
size Int: How big the view wants to be
measureSpec Int: Constraints imposed by the parent
Return
Int: Size information bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL.

getMeasuredWidthAndState

open static fun getMeasuredWidthAndState(view: View!): Int

Return the full width measurement information for this view as computed by the most recent call to android.view.View#measure(int, int). This result is a bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL. This should be used during measurement and layout calculations only. Use android.view.View#getWidth() to see how wide a view is after layout.

Return
Int: The measured width of this view as a bit mask.

getMeasuredHeightAndState

open static fun getMeasuredHeightAndState(view: View!): Int

Return the full height measurement information for this view as computed by the most recent call to android.view.View#measure(int, int). This result is a bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL. This should be used during measurement and layout calculations only. Use android.view.View#getHeight() to see how wide a view is after layout.

Return
Int: The measured width of this view as a bit mask.

getMeasuredState

open static fun getMeasuredState(view: View!): Int

Return only the state bits of getMeasuredWidthAndState and getMeasuredHeightAndState, combined into one integer. The width component is in the regular bits MEASURED_STATE_MASK and the height component is at the shifted bits MEASURED_HEIGHT_STATE_SHIFT>>MEASURED_STATE_MASK.

combineMeasuredStates

open static fun combineMeasuredStates(curState: Int, newState: Int): Int

Merge two states as returned by getMeasuredState(View).

Parameters
curState Int: The current state as returned from a view or the result of combining multiple views.
newState Int: The new view state to combine.
Return
Int: Returns a new integer reflecting the combination of the two states.

getAccessibilityLiveRegion

open static fun getAccessibilityLiveRegion(@NonNull view: View): Int

Gets the live region mode for the specified View.

Parameters
view View: The view from which to obtain the live region mode
Return
Int: The live region mode for the view.

setAccessibilityLiveRegion

open static fun setAccessibilityLiveRegion(@NonNull view: View, mode: Int): Unit

Sets the live region mode for the specified view. This indicates to accessibility services whether they should automatically notify the user about changes to the view's content description or text, or to the content descriptions or text of the view's children (where applicable).

For example, in a login screen with a TextView that displays an "incorrect password" notification, that view should be marked as a live region with mode ACCESSIBILITY_LIVE_REGION_POLITE.

To disable change notifications for this view, use ACCESSIBILITY_LIVE_REGION_NONE. This is the default live region mode for most views.

To indicate that the user should be notified of changes, use ACCESSIBILITY_LIVE_REGION_POLITE.

If the view's changes should interrupt ongoing speech and notify the user immediately, use ACCESSIBILITY_LIVE_REGION_ASSERTIVE.

Parameters
view View: The view on which to set the live region mode
mode View: The live region mode for this view, one of:

getPaddingStart

@Px open static fun getPaddingStart(@NonNull view: View): Int

Returns the start padding of the specified view depending on its resolved layout direction. If there are inset and enabled scrollbars, this value may include the space required to display the scrollbars as well.

Parameters
view View: The view to get padding for
Return
Int: the start padding in pixels

getPaddingEnd

@Px open static fun getPaddingEnd(@NonNull view: View): Int

Returns the end padding of the specified view depending on its resolved layout direction. If there are inset and enabled scrollbars, this value may include the space required to display the scrollbars as well.

Parameters
view View: The view to get padding for
Return
Int: the end padding in pixels

setPaddingRelative

open static fun setPaddingRelative(@NonNull view: View, @Px start: Int, @Px top: Int, @Px end: Int, @Px bottom: Int): Unit

Sets the relative padding. The view may add on the space required to display the scrollbars, depending on the style and visibility of the scrollbars. So the values returned from getPaddingStart, View#getPaddingTop, getPaddingEnd and View#getPaddingBottom may be different from the values set in this call.

Parameters
view View: The view on which to set relative padding
start View: the start padding in pixels
top View: the top padding in pixels
end View: the end padding in pixels
bottom View: the bottom padding in pixels

dispatchStartTemporaryDetach

open static fun dispatchStartTemporaryDetach(@NonNull view: View): Unit

Notify a view that it is being temporarily detached.

dispatchFinishTemporaryDetach

open static fun dispatchFinishTemporaryDetach(@NonNull view: View): Unit

Notify a view that its temporary detach has ended; the view is now reattached.

getTranslationX

open static fun getTranslationX(view: View!): Float

The horizontal location of this view relative to its left position. This position is post-layout, in addition to wherever the object's layout placed it.

Return
Float: The horizontal position of this view relative to its left position, in pixels.

getTranslationY

open static fun getTranslationY(view: View!): Float

The vertical location of this view relative to its top position. This position is post-layout, in addition to wherever the object's layout placed it.

Return
Float: The vertical position of this view relative to its top position, in pixels.

getMatrix

@Nullable open static fun getMatrix(view: View!): Matrix?

The transform matrix of this view, which is calculated based on the current rotation, scale, and pivot properties.

Parameters
view View!: The view whose Matrix will be returned
Return
Matrix?: The current transform matrix for the view

getMinimumWidth

open static fun getMinimumWidth(@NonNull view: View): Int

Returns the minimum width of the view.

Prior to API 16, this method may return 0 on some platforms.

Return
Int: the minimum width the view will try to be.

getMinimumHeight

open static fun getMinimumHeight(@NonNull view: View): Int

Returns the minimum height of the view.

Prior to API 16, this method may return 0 on some platforms.

Return
Int: the minimum height the view will try to be.

animate

@NonNull open static fun animate(@NonNull view: View): ViewPropertyAnimatorCompat

This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View.

Return
ViewPropertyAnimatorCompat: ViewPropertyAnimator The ViewPropertyAnimator associated with this View.

setTranslationX

open static fun setTranslationX(view: View!, value: Float): Unit

Sets the horizontal location of this view relative to its left position. This effectively positions the object post-layout, in addition to wherever the object's layout placed it.

Parameters
value View!: The horizontal position of this view relative to its left position, in pixels.

setTranslationY

open static fun setTranslationY(view: View!, value: Float): Unit

Sets the vertical location of this view relative to its top position. This effectively positions the object post-layout, in addition to wherever the object's layout placed it.

Parameters
value View!: The vertical position of this view relative to its top position, in pixels.

setAlpha

open static fun setAlpha(view: View!, value: Float): Unit

Sets the opacity of the view. This is a value from 0 to 1, where 0 means the view is completely transparent and 1 means the view is completely opaque.

Note that setting alpha to a translucent value (0 < alpha < 1) can have significant performance implications, especially for large views. It is best to use the alpha property sparingly and transiently, as in the case of fading animations.

Parameters
value View!: The opacity of the view.

setX

open static fun setX(view: View!, value: Float): Unit

Sets the visual x position of this view, in pixels. This is equivalent to setting the translationX property to be the difference between the x value passed in and the current left property of the view as determined by the layout bounds.

Parameters
value View!: The visual x position of this view, in pixels.

setY

open static fun setY(view: View!, value: Float): Unit

Sets the visual y position of this view, in pixels. This is equivalent to setting the translationY property to be the difference between the y value passed in and the current top property of the view as determined by the layout bounds.

Parameters
value View!: The visual y position of this view, in pixels.

setRotation

open static fun setRotation(view: View!, value: Float): Unit

Sets the degrees that the view is rotated around the pivot point. Increasing values result in clockwise rotation.

Parameters
value View!: The degrees of rotation.

setRotationX

open static fun setRotationX(view: View!, value: Float): Unit

Sets the degrees that the view is rotated around the horizontal axis through the pivot point. Increasing values result in clockwise rotation from the viewpoint of looking down the x axis.

Parameters
value View!: The degrees of X rotation.

setRotationY

open static fun setRotationY(view: View!, value: Float): Unit

Sets the degrees that the view is rotated around the vertical axis through the pivot point. Increasing values result in counter-clockwise rotation from the viewpoint of looking down the y axis.

Parameters
value View!: The degrees of Y rotation.

setScaleX

open static fun setScaleX(view: View!, value: Float): Unit

Sets the amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width. A value of 1 means that no scaling is applied.

Parameters
value View!: The scaling factor.

setScaleY

open static fun setScaleY(view: View!, value: Float): Unit

Sets the amount that the view is scaled in Y around the pivot point, as a proportion of the view's unscaled width. A value of 1 means that no scaling is applied.

Parameters
value View!: The scaling factor.

getPivotX

open static fun getPivotX(view: View!): Float

The x location of the point around which the view is rotated and scaled.

setPivotX

open static fun setPivotX(view: View!, value: Float): Unit

Sets the x location of the point around which the view is rotated and scaled. By default, the pivot point is centered on the object. Setting this property disables this behavior and causes the view to use only the explicitly set pivotX and pivotY values.

Parameters
value View!: The x location of the pivot point.

getPivotY

open static fun getPivotY(view: View!): Float

The y location of the point around which the view is rotated and scaled.

Return
Float: The y location of the pivot point.

setPivotY

open static fun setPivotY(view: View!, value: Float): Unit

Sets the y location of the point around which the view is rotated and scaled. By default, the pivot point is centered on the object. Setting this property disables this behavior and causes the view to use only the explicitly set pivotX and pivotY values.

Parameters
value View!: The y location of the pivot point.

getRotation

open static fun getRotation(view: View!): Float

getRotationX

open static fun getRotationX(view: View!): Float

getRotationY

open static fun getRotationY(view: View!): Float

getScaleX

open static fun getScaleX(view: View!): Float

getScaleY

open static fun getScaleY(view: View!): Float

getX

open static fun getX(view: View!): Float

getY

open static fun getY(view: View!): Float

setElevation

open static fun setElevation(@NonNull view: View, elevation: Float): Unit

Sets the base elevation of this view, in pixels.

getElevation

open static fun getElevation(@NonNull view: View): Float

The base elevation of this view relative to its parent, in pixels.

Return
Float: The base depth position of the view, in pixels.

setTranslationZ

open static fun setTranslationZ(@NonNull view: View, translationZ: Float): Unit

Sets the depth location of this view relative to its elevation.

getTranslationZ

open static fun getTranslationZ(@NonNull view: View): Float

The depth location of this view relative to its elevation.

Return
Float: The depth of this view relative to its elevation.

setTransitionName

open static fun setTransitionName(@NonNull view: View, transitionName: String!): Unit

Sets the name of the View to be used to identify Views in Transitions. Names should be unique in the View hierarchy.

Parameters
view View: The View against which to invoke the method.
transitionName View: The name of the View to uniquely identify it for Transitions.

getTransitionName

@Nullable open static fun getTransitionName(@NonNull view: View): String?

Returns the name of the View to be used to identify Views in Transitions. Names should be unique in the View hierarchy.

This returns null if the View has not been given a name.

Parameters
view View: The View against which to invoke the method.
Return
String?: The name used of the View to be used to identify Views in Transitions or null if no name has been given.

getWindowSystemUiVisibility

open static fun getWindowSystemUiVisibility(@NonNull view: View): Int

Returns the current system UI visibility that is currently set for the entire window.

requestApplyInsets

open static fun requestApplyInsets(@NonNull view: View): Unit

Ask that a new dispatch of View.onApplyWindowInsets(WindowInsets) be performed. This falls back to View.requestFitSystemWindows() where available.

setChildrenDrawingOrderEnabled

open static fun setChildrenDrawingOrderEnabled(viewGroup: ViewGroup!, enabled: Boolean): Unit

Tells the ViewGroup whether to draw its children in the order defined by the method ViewGroup.getChildDrawingOrder(int, int).

Parameters
enabled ViewGroup!: true if the order of the children when drawing is determined by ViewGroup#getChildDrawingOrder(int, int), false otherwise

Prior to API 7 this will have no effect.

getFitsSystemWindows

open static fun getFitsSystemWindows(@NonNull v: View): Boolean

Returns true if this view should adapt to fit system window insets. This method will always return false before API 16 (Jellybean).

setFitsSystemWindows

open static fun setFitsSystemWindows(view: View!, fitSystemWindows: Boolean): Unit

Sets whether or not this view should account for system screen decorations such as the status bar and inset its content; that is, controlling whether the default implementation of View#fitSystemWindows(Rect) will be executed. See that method for more details.

jumpDrawablesToCurrentState

open static fun jumpDrawablesToCurrentState(v: View!): Unit

On API 11 devices and above, call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.

On API 21 and above, also calls StateListAnimator#jumpToCurrentState() if there is a StateListAnimator attached to this view.

setOnApplyWindowInsetsListener

open static fun setOnApplyWindowInsetsListener(@NonNull v: View, listener: OnApplyWindowInsetsListener!): Unit

Set an OnApplyWindowInsetsListener to take over the policy for applying window insets to this view. This will only take effect on devices with API 21 or above.

onApplyWindowInsets

open static fun onApplyWindowInsets(@NonNull view: View, insets: WindowInsetsCompat!): WindowInsetsCompat!

Called when the view should apply WindowInsetsCompat according to its internal policy.

Clients may supply an OnApplyWindowInsetsListener to a view. If one is set it will be called during dispatch instead of this method. The listener may optionally call this method from its own implementation if it wishes to apply the view's default insets policy in addition to its own.

Parameters
view View: The View against which to invoke the method.
insets View: Insets to apply
Return
WindowInsetsCompat!: The supplied insets with any applied insets consumed

dispatchApplyWindowInsets

open static fun dispatchApplyWindowInsets(@NonNull view: View, insets: WindowInsetsCompat!): WindowInsetsCompat!

Request to apply the given window insets to this view or another view in its subtree.

This method should be called by clients wishing to apply insets corresponding to areas obscured by window decorations or overlays. This can include the status and navigation bars, action bars, input methods and more. New inset categories may be added in the future. The method returns the insets provided minus any that were applied by this view or its children.

Parameters
insets View: Insets to apply
Return
WindowInsetsCompat!: The provided insets minus the insets that were consumed

setSaveFromParentEnabled

open static fun setSaveFromParentEnabled(v: View!, enabled: Boolean): Unit

Controls whether the entire hierarchy under this view will save its state when a state saving traversal occurs from its parent.

Parameters
enabled View!: Set to false to disable state saving, or true (the default) to allow it.

setActivated

open static fun setActivated(view: View!, activated: Boolean): Unit

Changes the activated state of this view. A view can be activated or not. Note that activation is not the same as selection. Selection is a transient property, representing the view (hierarchy) the user is currently interacting with. Activation is a longer-term state that the user can move views in and out of.

Parameters
activated View!: true if the view must be activated, false otherwise

hasOverlappingRendering

open static fun hasOverlappingRendering(@NonNull view: View): Boolean

Returns whether this View has content which overlaps.

This function, intended to be overridden by specific View types, is an optimization when alpha is set on a view. If rendering overlaps in a view with alpha < 1, that view is drawn to an offscreen buffer and then composited into place, which can be expensive. If the view has no overlapping rendering, the view can draw each primitive with the appropriate alpha value directly. An example of overlapping rendering is a TextView with a background image, such as a Button. An example of non-overlapping rendering is a TextView with no background, or an ImageView with only the foreground image. The default implementation returns true; subclasses should override if they have cases which can be optimized.

Return
Boolean: true if the content in this view might overlap, false otherwise.

isPaddingRelative

open static fun isPaddingRelative(@NonNull view: View): Boolean

Return if the padding as been set through relative values View.setPaddingRelative(int, int, int, int) or thru

Return
Boolean: true if the padding is relative or false if it is not.

setBackground

open static fun setBackground(@NonNull view: View, @Nullable background: Drawable?): Unit

Set the background of the view to a given Drawable, or remove the background. If the background has padding, view's padding is set to the background's padding. However, when a background is removed, this View's padding isn't touched. If setting the padding is desired, please usesetPadding(int, int, int, int).

getBackgroundTintList

open static fun getBackgroundTintList(@NonNull view: View): ColorStateList!

Return the tint applied to the background drawable, if specified.

Only returns meaningful info when running on API v21 or newer, or if view implements the TintableBackgroundView interface.

setBackgroundTintList

open static fun setBackgroundTintList(@NonNull view: View, tintList: ColorStateList!): Unit

Applies a tint to the background drawable.

This will always take effect when running on API v21 or newer. When running on platforms previous to API v21, it will only take effect if view implements the TintableBackgroundView interface.

getBackgroundTintMode

open static fun getBackgroundTintMode(@NonNull view: View): Mode!

Return the blending mode used to apply the tint to the background drawable, if specified.

Only returns meaningful info when running on API v21 or newer, or if view implements the TintableBackgroundView interface.

setBackgroundTintMode

open static fun setBackgroundTintMode(@NonNull view: View, mode: Mode!): Unit

Specifies the blending mode used to apply the tint specified by setBackgroundTintList(android.view.View, android.content.res.ColorStateList) to the background drawable. The default mode is PorterDuff.Mode#SRC_IN.

This will always take effect when running on API v21 or newer. When running on platforms previous to API v21, it will only take effect if view implement the TintableBackgroundView interface.

setNestedScrollingEnabled

open static fun setNestedScrollingEnabled(@NonNull view: View, enabled: Boolean): Unit

Enable or disable nested scrolling for this view.

If this property is set to true the view will be permitted to initiate nested scrolling operations with a compatible parent view in the current hierarchy. If this view does not implement nested scrolling this will have no effect. Disabling nested scrolling while a nested scroll is in progress has the effect of stopping the nested scroll.

Parameters
enabled View: true to enable nested scrolling, false to disable

isNestedScrollingEnabled

open static fun isNestedScrollingEnabled(@NonNull view: View): Boolean

Returns true if nested scrolling is enabled for this view.

If nested scrolling is enabled and this View class implementation supports it, this view will act as a nested scrolling child view when applicable, forwarding data about the scroll operation in progress to a compatible and cooperating nested scrolling parent.

Return
Boolean: true if nested scrolling is enabled

startNestedScroll

open static fun startNestedScroll(@NonNull view: View, axes: Int): Boolean

Begin a nestable scroll operation along the given axes.

This version of the method just calls startNestedScroll(View, int, int) using the touch input type.

Parameters
axes View: Flags consisting of a combination of ViewCompat#SCROLL_AXIS_HORIZONTAL and/or ViewCompat#SCROLL_AXIS_VERTICAL.
Return
Boolean: true if a cooperative parent was found and nested scrolling has been enabled for the current gesture.

startNestedScroll

open static fun startNestedScroll(@NonNull view: View, axes: Int, type: Int): Boolean

Begin a nestable scroll operation along the given axes.

A view starting a nested scroll promises to abide by the following contract:

The view will call startNestedScroll upon initiating a scroll operation. In the case of a touch scroll this corresponds to the initial MotionEvent#ACTION_DOWN. In the case of touch scrolling the nested scroll will be terminated automatically in the same manner as ViewParent#requestDisallowInterceptTouchEvent(boolean). In the event of programmatic scrolling the caller must explicitly call stopNestedScroll(View) to indicate the end of the nested scroll.

If startNestedScroll returns true, a cooperative parent was found. If it returns false the caller may ignore the rest of this contract until the next scroll. Calling startNestedScroll while a nested scroll is already in progress will return true.

At each incremental step of the scroll the caller should invoke dispatchNestedPreScroll once it has calculated the requested scrolling delta. If it returns true the nested scrolling parent at least partially consumed the scroll and the caller should adjust the amount it scrolls by.

After applying the remainder of the scroll delta the caller should invoke dispatchNestedScroll, passing both the delta consumed and the delta unconsumed. A nested scrolling parent may treat these values differently. See NestedScrollingParent#onNestedScroll(View, int, int, int, int).

Parameters
axes View: Flags consisting of a combination of ViewCompat#SCROLL_AXIS_HORIZONTAL and/or ViewCompat#SCROLL_AXIS_VERTICAL.
type View: the type of input which cause this scroll event
Return
Boolean: true if a cooperative parent was found and nested scrolling has been enabled for the current gesture.

stopNestedScroll

open static fun stopNestedScroll(@NonNull view: View): Unit

Stop a nested scroll in progress.

This version of the method just calls stopNestedScroll(View, int) using the touch input type.

stopNestedScroll

open static fun stopNestedScroll(@NonNull view: View, type: Int): Unit

Stop a nested scroll in progress.

Calling this method when a nested scroll is not currently in progress is harmless.

Parameters
type View: the type of input which cause this scroll event

hasNestedScrollingParent

open static fun hasNestedScrollingParent(@NonNull view: View): Boolean

Returns true if this view has a nested scrolling parent.

This version of the method just calls hasNestedScrollingParent(View, int) using the touch input type.

Return
Boolean: whether this view has a nested scrolling parent

hasNestedScrollingParent

open static fun hasNestedScrollingParent(@NonNull view: View, type: Int): Boolean

Returns true if this view has a nested scrolling parent.

The presence of a nested scrolling parent indicates that this view has initiated a nested scroll and it was accepted by an ancestor view further up the view hierarchy.

Parameters
type View: the type of input which cause this scroll event
Return
Boolean: whether this view has a nested scrolling parent

dispatchNestedScroll

open static fun dispatchNestedScroll(@NonNull view: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: IntArray?): Boolean

Dispatch one step of a nested scroll in progress.

This version of the method just calls dispatchNestedScroll(View, int, int, int, int, int[], int) using the touch input type.

Parameters
dxConsumed View: Horizontal distance in pixels consumed by this view during this scroll step
dyConsumed View: Vertical distance in pixels consumed by this view during this scroll step
dxUnconsumed View: Horizontal scroll distance in pixels not consumed by this view
dyUnconsumed View: Horizontal scroll distance in pixels not consumed by this view
offsetInWindow View: Optional. If not null, on return this will contain the offset in local view coordinates of this view from before this operation to after it completes. View implementations may use this to adjust expected input coordinate tracking.
Return
Boolean: true if the event was dispatched, false if it could not be dispatched.

dispatchNestedScroll

open static fun dispatchNestedScroll(@NonNull view: View, dxConsumed: Int,