Skip to content

Most visited

Recently visited

navigation

ViewGroupCompat

public final class ViewGroupCompat
extends Object

java.lang.Object
   ↳ android.support.v4.view.ViewGroupCompat


Helper for accessing features in ViewGroup.

Summary

Constants

int LAYOUT_MODE_CLIP_BOUNDS

This constant is a layoutMode.

int LAYOUT_MODE_OPTICAL_BOUNDS

This constant is a layoutMode.

Public methods

static int getLayoutMode(ViewGroup group)

Returns the basis of alignment during layout operations on this ViewGroup: either LAYOUT_MODE_CLIP_BOUNDS or LAYOUT_MODE_OPTICAL_BOUNDS.

static int getNestedScrollAxes(ViewGroup group)

Return the current axes of nested scrolling for this ViewGroup.

static boolean isTransitionGroup(ViewGroup group)

Returns true if this ViewGroup should be considered as a single entity for removal when executing an Activity transition.

static boolean onRequestSendAccessibilityEvent(ViewGroup group, View child, AccessibilityEvent event)

This method was deprecated in API level 26.0.0. Use onRequestSendAccessibilityEvent(View, AccessibilityEvent) directly.

static void setLayoutMode(ViewGroup group, int mode)

Sets the basis of alignment during the layout of this ViewGroup.

static void setMotionEventSplittingEnabled(ViewGroup group, boolean split)

This method was deprecated in API level 26.0.0. Use setMotionEventSplittingEnabled(boolean) directly.

static void setTransitionGroup(ViewGroup group, boolean isTransitionGroup)

Changes whether or not this ViewGroup should be treated as a single entity during Activity Transitions.

Inherited methods

From class java.lang.Object

Constants

LAYOUT_MODE_CLIP_BOUNDS

added in version 22.0.0
int LAYOUT_MODE_CLIP_BOUNDS

This constant is a layoutMode. Clip bounds are the raw values of left, top, right and bottom.

Constant Value: 0 (0x00000000)

LAYOUT_MODE_OPTICAL_BOUNDS

added in version 22.0.0
int LAYOUT_MODE_OPTICAL_BOUNDS

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.

Constant Value: 1 (0x00000001)

Public methods

getLayoutMode

added in version 22.0.0
int getLayoutMode (ViewGroup group)

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.

Parameters
group ViewGroup

Returns
int the layout mode to use during layout operations

See also:

getNestedScrollAxes

added in version 22.1.0
int getNestedScrollAxes (ViewGroup group)

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.

Parameters
group ViewGroup

Returns
int Flags indicating the current axes of nested scrolling

See also:

isTransitionGroup

added in version 22.0.0
boolean isTransitionGroup (ViewGroup group)

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.

Parameters
group ViewGroup

Returns
boolean

onRequestSendAccessibilityEvent

added in version 22.0.0
boolean onRequestSendAccessibilityEvent (ViewGroup group, 
                View child, 
                AccessibilityEvent event)

This method was deprecated in API level 26.0.0.
Use onRequestSendAccessibilityEvent(View, AccessibilityEvent) directly.

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(View, AccessibilityDelegateCompat) its onRequestSendAccessibilityEvent(ViewGroup, View, AccessibilityEvent) 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.

setLayoutMode

added in version 22.0.0
void setLayoutMode (ViewGroup group, 
                int mode)

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

mode int: the layout mode to use during layout operations

See also:

setMotionEventSplittingEnabled

added in version 22.0.0
void setMotionEventSplittingEnabled (ViewGroup group, 
                boolean split)

This method was deprecated in API level 26.0.0.
Use setMotionEventSplittingEnabled(boolean) directly.

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.

Parameters
group ViewGroup: ViewGroup to modify

split boolean: true to allow MotionEvents to be split and dispatched to multiple child views. false to only allow one child view to be the target of any MotionEvent received by this ViewGroup.

setTransitionGroup

added in version 22.0.0
void setTransitionGroup (ViewGroup group, 
                boolean isTransitionGroup)

Changes whether or not this ViewGroup should be treated as a single entity during Activity Transitions.

Parameters
group ViewGroup

isTransitionGroup boolean: Whether or not the ViewGroup should be treated as a unit in Activity transitions. If false, the ViewGroup won't transition, only its children. If true, the entire ViewGroup will transition together.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.