Google 致力于为黑人社区推动种族平等。查看具体举措

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

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

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

Automatically determine whether a 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

The view is important for accessibility.

static Int

Indicates that the view has a hardware layer.

static Int

Indicates that the view does not have a layer.

static Int

Indicates that the view has a software layer.

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

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

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

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 of getMeasuredWidthAndState and getMeasuredWidthAndState that indicates the measured size is smaller that the space the view would like to have.

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

Indicates scrolling along the horizontal axis.

static Int

Indicates no axis of view scrolling.

static Int

Indicates scrolling along the vertical axis.

static Int

Scroll indicator direction for the bottom edge of the view.

static Int

Scroll indicator direction for the ending 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 top edge of the view.

static Int

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

static Int

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

Protected constructors

Public methods
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
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 Unit

Adds a listener which will receive unhandled KeyEvents.

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 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 Unit
cancelDragAndDrop(@NonNull v: View)

Cancel the drag and drop operation.

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

Merge two states as returned by getMeasuredState(View).

open static WindowInsetsCompat
computeSystemWindowInsets(@NonNull view: View, @NonNull insets: WindowInsetsCompat, @NonNull outLocalInsets: Rect)

Compute insets that should be consumed by this view and the ones that should propagate to those under it.

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

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

open static Unit

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

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
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
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 Unit

Notify a view that it is being temporarily detached.

open static Unit

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

open static Int

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

open static AccessibilityDelegateCompat?

Get the current accessibility delegate.

open static Int

Gets the live region mode for the specified View.

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 CharSequence!

Get the title of the pane for purposes of accessibility.

open static Float
getAlpha(view: View!)

The opacity of the view.

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

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

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

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

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

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

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

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

open static Float
getElevation(@NonNull view: View)

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

open static Boolean

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

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 Int

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

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 Int

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

open static Int
getLayoutDirection(@NonNull view: View)

Returns the resolved layout direction for this view.

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

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

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
getMinimumHeight(@NonNull view: View)

Returns the minimum height of the view.

open static Int
getMinimumWidth(@NonNull view: View)

Returns the minimum width of the view.

open static Int
getNextClusterForwardId(@NonNull view: View)

Gets the ID of the next keyboard navigation cluster root.

open static Int

Returns the over-scroll mode for this view.

open static Int
getPaddingEnd(@NonNull view: View)

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

open static Int
getPaddingStart(@NonNull view: View)

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

open static ViewParent!

Gets the parent for accessibility purposes.

open static Float
getPivotX(view: View!)

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 WindowInsetsCompat?
getRootWindowInsets(@NonNull view: View)

Provide original WindowInsetsCompat that are dispatched to the view hierarchy.

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 Int
getScrollIndicators(@NonNull view: View)

Returns a bitmask representing the enabled scroll indicators.

static CharSequence?
getStateDescription(@NonNull view: View)

Returns the View's state description.

open static MutableList<Rect!>

Retrieve the list of areas within this view's post-layout coordinate space where the system should not intercept touch or other pointing device gestures.

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

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

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 Float
getTranslationZ(@NonNull view: View)

The depth location of this view relative to its elevation.

open static WindowInsetsControllerCompat?

Retrieves a WindowInsetsControllerCompat of the window this view is attached to.

open static Int

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

open static Float
getX(view: View!)

open static Float
getY(view: View!)