ViewCompat

Added in 1.1.0

public class ViewCompat


Helper for accessing features in View.

Summary

Nested types

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

Constants

static final int

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

static final int

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

static final int

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

static final int

This field is deprecated.

Use IMPORTANT_FOR_ACCESSIBILITY_AUTO directly.

static final int

This field is deprecated.

Use IMPORTANT_FOR_ACCESSIBILITY_NO directly.

static final int

This field is deprecated.

Use IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS directly.

static final int

This field is deprecated.

Use IMPORTANT_FOR_ACCESSIBILITY_YES directly.

static final int

Automatically determine whether a view is important for content capture.

static final int

The view is not important for content capture, but its children (if any) will be traversed.

static final int

The view is not important for content capture, and its children (if any) will not be traversed.

static final int

The view is important for content capture, and its children (if any) will be traversed.

static final int

The view is important for content capture, but its children (if any) will not be traversed.

static final int

This field is deprecated.

Use LAYER_TYPE_HARDWARE directly.

static final int

This field is deprecated.

Use LAYER_TYPE_NONE directly.

static final int

This field is deprecated.

Use LAYER_TYPE_SOFTWARE directly.

static final int

This field is deprecated.

Use LAYOUT_DIRECTION_INHERIT directly.

static final int

This field is deprecated.

Use LAYOUT_DIRECTION_LOCALE directly.

static final int

This field is deprecated.

Use LAYOUT_DIRECTION_LTR directly.

static final int

This field is deprecated.

Use LAYOUT_DIRECTION_RTL directly.

static final int

This field is deprecated.

Use MEASURED_HEIGHT_STATE_SHIFT directly.

static final int

This field is deprecated.

Use MEASURED_SIZE_MASK directly.

static final int

This field is deprecated.

Use MEASURED_STATE_MASK directly.

static final int

This field is deprecated.

Use MEASURED_STATE_TOO_SMALL directly.

static final int

This field is deprecated.

Use OVER_SCROLL_ALWAYS directly.

static final int

This field is deprecated.

Use OVER_SCROLL_IF_CONTENT_SCROLLS directly.

static final int

This field is deprecated.

Use OVER_SCROLL_NEVER directly.

static final int

Indicates scrolling along the horizontal axis.

static final int

Indicates no axis of view scrolling.

static final int

Indicates scrolling along the vertical axis.

static final int

Scroll indicator direction for the bottom edge of the view.

static final int

Scroll indicator direction for the ending edge of the view.

static final int

Scroll indicator direction for the left edge of the view.

static final int

Scroll indicator direction for the right edge of the view.

static final int

Scroll indicator direction for the starting edge of the view.

static final int

Scroll indicator direction for the top edge of the view.

static final int

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

static final int

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

Protected constructors

This method is deprecated.

This is a utility class and it shouldn't be instantiated.

Public methods

static int
addAccessibilityAction(
    @NonNull View view,
    @NonNull CharSequence label,
    @NonNull AccessibilityViewCommand command
)

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

static void
addKeyboardNavigationClusters(
    @NonNull View view,
    @NonNull Collection<View> views,
    int direction
)

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

static void

Adds a listener which will receive unhandled KeyEvents.

static void
addOverlayView(@NonNull ViewGroup overlayHost, @NonNull View overlay)

Convenience method to add overlay to overlayHost's overlay and assign the disjointParent in the overlay hierarchy.

static @NonNull ViewPropertyAnimatorCompat

This method is deprecated.

Call animate directly.

static boolean
@ReplaceWith(expression = "view.canScrollHorizontally(direction)")
canScrollHorizontally(View view, int direction)

This method is deprecated.

Use canScrollHorizontally directly.

static boolean
@ReplaceWith(expression = "view.canScrollVertically(direction)")
canScrollVertically(View view, int direction)

This method is deprecated.

Use canScrollVertically directly.

static void

Cancel the drag and drop operation.

static int
combineMeasuredStates(int curState, int newState)

This method is deprecated.

Use combineMeasuredStates directly.

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

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

static @NonNull WindowInsetsCompat

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

static void

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

static boolean
dispatchNestedFling(
    @NonNull View view,
    float velocityX,
    float velocityY,
    boolean consumed
)

Dispatch a fling to a nested scrolling parent.

static boolean
dispatchNestedPreFling(
    @NonNull View view,
    float velocityX,
    float velocityY
)

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

static boolean
dispatchNestedPreScroll(
    @NonNull View view,
    int dx,
    int dy,
    @Nullable int[] consumed,
    @Nullable int[] offsetInWindow
)

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

static boolean
dispatchNestedPreScroll(
    @NonNull View view,
    int dx,
    int dy,
    @Nullable int[] consumed,
    @<a href="http