ViewGroupCompat
class ViewGroupCompat
Helper for accessing features in ViewGroup.
Summary
Constants |
|
|---|---|
const Int |
This constant is a |
const Int |
This constant is a |
Public functions |
|
|---|---|
java-static Int |
@ReplaceWith(expression = "group.getLayoutMode()")This function is deprecated. Call |
java-static Int |
getNestedScrollAxes(group: ViewGroup)Return the current axes of nested scrolling for this ViewGroup. |
java-static Unit |
installCompatInsetsDispatch(root: View)Installs a custom |
java-static Boolean |
isTransitionGroup(group: ViewGroup)Returns true if this ViewGroup should be considered as a single entity for removal when executing an Activity transition. |
java-static Boolean |
@ReplaceWith(expression = "group.onRequestSendAccessibilityEvent(child, event)")This function is deprecated. Use |
java-static Unit |
@ReplaceWith(expression = "group.setLayoutMode(mode)")This function is deprecated. Call setLayoutMode directly. |
java-static Unit |
@ReplaceWith(expression = "group.setMotionEventSplittingEnabled(split)")This function is deprecated. Use |
java-static Unit |
setTransitionGroup(group: ViewGroup, isTransitionGroup: Boolean)Changes whether or not this ViewGroup should be treated as a single entity during Activity Transitions. |
Constants
LAYOUT_MODE_CLIP_BOUNDS
const val LAYOUT_MODE_CLIP_BOUNDS = 0: Int
This constant is a layoutMode. Clip bounds are the raw values of left, top, right and bottom.
LAYOUT_MODE_OPTICAL_BOUNDS
const val LAYOUT_MODE_OPTICAL_BOUNDS = 1: Int
This constant is a layoutMode. Optical bounds describe where a widget appears to be. They sit inside the clip bounds which need to cover a larger area to allow other effects, such as shadows and glows, to be drawn.
Public functions
@ReplaceWith(expression = "group.getLayoutMode()")
java-static fungetLayoutMode(group: ViewGroup): Int
Returns the basis of alignment during layout operations on this ViewGroup: either LAYOUT_MODE_CLIP_BOUNDS or LAYOUT_MODE_OPTICAL_BOUNDS.
If no layoutMode was explicitly set, either programmatically or in an XML resource, the method returns the layoutMode of the view's parent ViewGroup if such a parent exists, otherwise the method returns a default value of LAYOUT_MODE_CLIP_BOUNDS.
| Returns | |
|---|---|
Int |
the layout mode to use during layout operations |
| See also | |
|---|---|
setLayoutMode |
getNestedScrollAxes
java-static fun getNestedScrollAxes(group: ViewGroup): Int
Return the current axes of nested scrolling for this ViewGroup.
A ViewGroup returning something other than SCROLL_AXIS_NONE is currently acting as a nested scrolling parent for one or more descendant views in the hierarchy.
| Returns | |
|---|---|
Int |
Flags indicating the current axes of nested scrolling |
installCompatInsetsDispatch
java-static fun installCompatInsetsDispatch(root: View): Unit
Installs a custom View.OnApplyWindowInsetsListener which dispatches WindowInsets to the given root and its descendants in a way compatible with Android R+ that consuming or modifying insets will only affect the descendants.
Note: When using this method, ensure that ViewCompat.setOnApplyWindowInsetsListener() is used instead of the platform call.
| Parameters | |
|---|---|
root: View |
The root view that the custom listener is installed on. Note: the listener will consume the insets, so make sure the given root is the root view of the window, or its siblings might not be able to get insets dispatched. |
isTransitionGroup
java-static fun isTransitionGroup(group: ViewGroup): Boolean
Returns true if this ViewGroup should be considered as a single entity for removal when executing an Activity transition. If this is false, child elements will move individually during the transition.
@ReplaceWith(expression = "group.onRequestSendAccessibilityEvent(child, event)")
java-static funonRequestSendAccessibilityEvent(
group: ViewGroup!,
child: View!,
event: AccessibilityEvent!
): Boolean
Called when a child has requested sending an AccessibilityEvent and gives an opportunity to its parent to augment the event.
If an AccessibilityDelegateCompat has been specified via calling setAccessibilityDelegate its onRequestSendAccessibilityEvent is responsible for handling this call.
| Parameters | |
|---|---|
group: ViewGroup! |
The group whose method to invoke. |
child: View! |
The child which requests sending the event. |
event: AccessibilityEvent! |
The event to be sent. |
| Returns | |
|---|---|
Boolean |
True if the event should be sent. |
@ReplaceWith(expression = "group.setLayoutMode(mode)")
java-static funsetLayoutMode(group: ViewGroup, mode: Int): Unit
Sets the basis of alignment during the layout of this ViewGroup. Valid values are either LAYOUT_MODE_CLIP_BOUNDS or LAYOUT_MODE_OPTICAL_BOUNDS.
| Parameters | |
|---|---|
group: ViewGroup |
ViewGroup for which to set the mode. |
mode: Int |
the layout mode to use during layout operations |
| See also | |
|---|---|
getLayoutMode |
@ReplaceWith(expression = "group.setMotionEventSplittingEnabled(split)")
java-static funsetMotionEventSplittingEnabled(group: ViewGroup!, split: Boolean): Unit
Enable or disable the splitting of MotionEvents to multiple children during touch event dispatch. This behavior is enabled by default for applications that target an SDK version of 11 (Honeycomb) or newer. On earlier platform versions this feature was not supported and this method is a no-op.
When this option is enabled MotionEvents may be split and dispatched to different child views depending on where each pointer initially went down. This allows for user interactions such as scrolling two panes of content independently, chording of buttons, and performing independent gestures on different pieces of content.
setTransitionGroup
java-static fun setTransitionGroup(group: ViewGroup, isTransitionGroup: Boolean): Unit
Changes whether or not this ViewGroup should be treated as a single entity during Activity Transitions.