# ViewGroupCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Constants](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#constants)\|[Methods](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#)  

# ViewGroupCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
ViewGroupCompat
`  
`

extends Object


``


`

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

<br />

*** ** * ** ***

Helper for accessing features in[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html).

## Summary

|                                                                                                                                                ### Constants                                                                                                                                                ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [LAYOUT_MODE_CLIP_BOUNDS](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#LAYOUT_MODE_CLIP_BOUNDS) This constant is a[layoutMode](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#setLayoutMode(android.view.ViewGroup, int)).       |
| `int` | [LAYOUT_MODE_OPTICAL_BOUNDS](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#LAYOUT_MODE_OPTICAL_BOUNDS) This constant is a[layoutMode](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#setLayoutMode(android.view.ViewGroup, int)). |

|                                                                                                                                                                                                                                                                                                                                                                                                                             ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static int`     | ` `[getLayoutMode](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#getLayoutMode(android.view.ViewGroup))`(`[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` group) ` Returns the basis of alignment during layout operations on this ViewGroup: either[LAYOUT_MODE_CLIP_BOUNDS](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#LAYOUT_MODE_CLIP_BOUNDS)or[LAYOUT_MODE_OPTICAL_BOUNDS](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#LAYOUT_MODE_OPTICAL_BOUNDS).                                                                                                                                                                                                                                                   |
| ` static int`     | ` `[getNestedScrollAxes](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#getNestedScrollAxes(android.view.ViewGroup))`(`[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` group) ` Return the current axes of nested scrolling for this ViewGroup.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` static boolean` | ` `[isTransitionGroup](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#isTransitionGroup(android.view.ViewGroup))`(`[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` group) ` Returns true if this ViewGroup should be considered as a single entity for removal when executing an Activity transition.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` static boolean` | ` `[onRequestSendAccessibilityEvent](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent))`(`[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` group, `[View](https://developer.android.com/reference/android/view/View.html)` child, `[AccessibilityEvent](https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html)` event) ` *This method was deprecated in API level 26.1.0. Use[onRequestSendAccessibilityEvent(View, AccessibilityEvent)](https://developer.android.com/reference/android/view/ViewGroup.html#onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent))directly.* |
| ` static void`    | ` `[setLayoutMode](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#setLayoutMode(android.view.ViewGroup, int))`(`[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` group, int mode) ` Sets the basis of alignment during the layout of this ViewGroup.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` static void`    | ` `[setMotionEventSplittingEnabled](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#setMotionEventSplittingEnabled(android.view.ViewGroup, boolean))`(`[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` group, boolean split) ` *This method was deprecated in API level 26.1.0. Use[setMotionEventSplittingEnabled(boolean)](https://developer.android.com/reference/android/view/ViewGroup.html#setMotionEventSplittingEnabled(boolean))directly.*                                                                                                                                                                                                                                                                                                                                   |
| ` static void`    | ` `[setTransitionGroup](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#setTransitionGroup(android.view.ViewGroup, boolean))`(`[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` group, boolean isTransitionGroup) ` Changes whether or not this ViewGroup should be treated as a single entity during Activity Transitions.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Constants

### LAYOUT_MODE_CLIP_BOUNDS

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int LAYOUT_MODE_CLIP_BOUNDS
```

This constant is a[layoutMode](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#setLayoutMode(android.view.ViewGroup, int)). Clip bounds are the raw values of[left](https://developer.android.com/reference/android/view/View.html#getLeft()),[top](https://developer.android.com/reference/android/view/View.html#getTop()),[right](https://developer.android.com/reference/android/view/View.html#getRight())and[bottom](https://developer.android.com/reference/android/view/View.html#getBottom()).

<br />

Constant Value: 0 (0x00000000)  

### LAYOUT_MODE_OPTICAL_BOUNDS

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int LAYOUT_MODE_OPTICAL_BOUNDS
```

This constant is a[layoutMode](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#setLayoutMode(android.view.ViewGroup, int)). 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.

<br />

Constant Value: 1 (0x00000001)

## Public methods

### getLayoutMode

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getLayoutMode (ViewGroup group)
```

Returns the basis of alignment during layout operations on this ViewGroup: either[LAYOUT_MODE_CLIP_BOUNDS](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#LAYOUT_MODE_CLIP_BOUNDS)or[LAYOUT_MODE_OPTICAL_BOUNDS](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#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](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#LAYOUT_MODE_CLIP_BOUNDS).

<br />

|         Parameters          ||
|---------|--------------------|
| `group` | `ViewGroup` <br /> |

|                            Returns                            ||
|-------|--------------------------------------------------------|
| `int` | the layout mode to use during layout operations <br /> |

**See also:**

- [setLayoutMode(ViewGroup, int)](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#setLayoutMode(android.view.ViewGroup, int))  

### getNestedScrollAxes

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getNestedScrollAxes (ViewGroup group)
```

Return the current axes of nested scrolling for this ViewGroup.

A ViewGroup returning something other than[SCROLL_AXIS_NONE](https://developer.android.com/reference/android/support/v4/view/ViewCompat#SCROLL_AXIS_NONE)is currently acting as a nested scrolling parent for one or more descendant views in the hierarchy.

<br />

<br />

|         Parameters          ||
|---------|--------------------|
| `group` | `ViewGroup` <br /> |

|                               Returns                               ||
|-------|--------------------------------------------------------------|
| `int` | Flags indicating the current axes of nested scrolling <br /> |

**See also:**

- [SCROLL_AXIS_HORIZONTAL](https://developer.android.com/reference/android/support/v4/view/ViewCompat#SCROLL_AXIS_HORIZONTAL)
- [SCROLL_AXIS_VERTICAL](https://developer.android.com/reference/android/support/v4/view/ViewCompat#SCROLL_AXIS_VERTICAL)
- [SCROLL_AXIS_NONE](https://developer.android.com/reference/android/support/v4/view/ViewCompat#SCROLL_AXIS_NONE)  

### isTransitionGroup

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
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.

<br />

|         Parameters          ||
|---------|--------------------|
| `group` | `ViewGroup` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### onRequestSendAccessibilityEvent

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

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

<br />

**This method was deprecated in API level 26.1.0.**   
Use[onRequestSendAccessibilityEvent(View, AccessibilityEvent)](https://developer.android.com/reference/android/view/ViewGroup.html#onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent))directly.

Called when a child has requested sending an[AccessibilityEvent](https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html)and gives an opportunity to its parent to augment the event.

If an[AccessibilityDelegateCompat](https://developer.android.com/reference/android/support/v4/view/AccessibilityDelegateCompat)has been specified via calling[setAccessibilityDelegate(View, AccessibilityDelegateCompat)](https://developer.android.com/reference/android/support/v4/view/ViewCompat#setAccessibilityDelegate(android.view.View, android.support.v4.view.AccessibilityDelegateCompat))its[onRequestSendAccessibilityEvent(ViewGroup, View, AccessibilityEvent)](https://developer.android.com/reference/android/support/v4/view/AccessibilityDelegateCompat#onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent))is responsible for handling this call.

<br />

<br />

|                             Parameters                              ||
|---------|------------------------------------------------------------|
| `group` | `ViewGroup`: The group whose method to invoke. <br />      |
| `child` | `View`: The child which requests sending the event. <br /> |
| `event` | `AccessibilityEvent`: The event to be sent. <br />         |

|                       Returns                       ||
|-----------|------------------------------------------|
| `boolean` | True if the event should be sent. <br /> |

### setLayoutMode

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
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](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#LAYOUT_MODE_CLIP_BOUNDS)or[LAYOUT_MODE_OPTICAL_BOUNDS](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#LAYOUT_MODE_OPTICAL_BOUNDS).

<br />

|                               Parameters                               ||
|---------|---------------------------------------------------------------|
| `group` | `ViewGroup` <br />                                            |
| `mode`  | `int`: the layout mode to use during layout operations <br /> |

**See also:**

- [getLayoutMode(ViewGroup)](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat#getLayoutMode(android.view.ViewGroup))  

### setMotionEventSplittingEnabled

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setMotionEventSplittingEnabled (ViewGroup group, 
                boolean split)
```

<br />

**This method was deprecated in API level 26.1.0.**   
Use[setMotionEventSplittingEnabled(boolean)](https://developer.android.com/reference/android/view/ViewGroup.html#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.

<br />

|                                                                                                  Parameters                                                                                                  ||
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `group` | `ViewGroup`: ViewGroup to modify <br />                                                                                                                                                             |
| `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. <br /> |

### setTransitionGroup

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setTransitionGroup (ViewGroup group, 
                boolean isTransitionGroup)
```

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

<br />

|                                                                                                                  Parameters                                                                                                                   ||
|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `group`             | `ViewGroup` <br />                                                                                                                                                                                                       |
| `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. <br /> |

-

  ## Annotations

  - [ViewPager.DecorView](https://developer.android.com/reference/android/support/v4/view/ViewPager.DecorView)
-

  ## Interfaces

  - [ActionProvider.VisibilityListener](https://developer.android.com/reference/android/support/v4/view/ActionProvider.VisibilityListener)
  - [AsyncLayoutInflater.OnInflateFinishedListener](https://developer.android.com/reference/android/support/v4/view/AsyncLayoutInflater.OnInflateFinishedListener)
  - [LayoutInflaterFactory](https://developer.android.com/reference/android/support/v4/view/LayoutInflaterFactory)
  - [MenuItemCompat.OnActionExpandListener](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat.OnActionExpandListener)
  - [NestedScrollingChild](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChild)
  - [NestedScrollingChild2](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChild2)
  - [NestedScrollingParent](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParent)
  - [NestedScrollingParent2](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParent2)
  - [OnApplyWindowInsetsListener](https://developer.android.com/reference/android/support/v4/view/OnApplyWindowInsetsListener)
  - [ScrollingView](https://developer.android.com/reference/android/support/v4/view/ScrollingView)
  - [TintableBackgroundView](https://developer.android.com/reference/android/support/v4/view/TintableBackgroundView)
  - [ViewPager.OnAdapterChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.OnAdapterChangeListener)
  - [ViewPager.OnPageChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.OnPageChangeListener)
  - [ViewPager.PageTransformer](https://developer.android.com/reference/android/support/v4/view/ViewPager.PageTransformer)
  - [ViewPropertyAnimatorListener](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorListener)
  - [ViewPropertyAnimatorUpdateListener](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorUpdateListener)
-

  ## Classes

  - [AbsSavedState](https://developer.android.com/reference/android/support/v4/view/AbsSavedState)
  - [AccessibilityDelegateCompat](https://developer.android.com/reference/android/support/v4/view/AccessibilityDelegateCompat)
  - [ActionProvider](https://developer.android.com/reference/android/support/v4/view/ActionProvider)
  - [AsyncLayoutInflater](https://developer.android.com/reference/android/support/v4/view/AsyncLayoutInflater)
  - [GestureDetectorCompat](https://developer.android.com/reference/android/support/v4/view/GestureDetectorCompat)
  - [GravityCompat](https://developer.android.com/reference/android/support/v4/view/GravityCompat)
  - [InputDeviceCompat](https://developer.android.com/reference/android/support/v4/view/InputDeviceCompat)
  - [LayoutInflaterCompat](https://developer.android.com/reference/android/support/v4/view/LayoutInflaterCompat)
  - [MarginLayoutParamsCompat](https://developer.android.com/reference/android/support/v4/view/MarginLayoutParamsCompat)
  - [MenuCompat](https://developer.android.com/reference/android/support/v4/view/MenuCompat)
  - [MenuItemCompat](https://developer.android.com/reference/android/support/v4/view/MenuItemCompat)
  - [MotionEventCompat](https://developer.android.com/reference/android/support/v4/view/MotionEventCompat)
  - [NestedScrollingChildHelper](https://developer.android.com/reference/android/support/v4/view/NestedScrollingChildHelper)
  - [NestedScrollingParentHelper](https://developer.android.com/reference/android/support/v4/view/NestedScrollingParentHelper)
  - [PagerAdapter](https://developer.android.com/reference/android/support/v4/view/PagerAdapter)
  - [PagerTabStrip](https://developer.android.com/reference/android/support/v4/view/PagerTabStrip)
  - [PagerTitleStrip](https://developer.android.com/reference/android/support/v4/view/PagerTitleStrip)
  - [PointerIconCompat](https://developer.android.com/reference/android/support/v4/view/PointerIconCompat)
  - [ScaleGestureDetectorCompat](https://developer.android.com/reference/android/support/v4/view/ScaleGestureDetectorCompat)
  - [VelocityTrackerCompat](https://developer.android.com/reference/android/support/v4/view/VelocityTrackerCompat)
  - [ViewCompat](https://developer.android.com/reference/android/support/v4/view/ViewCompat)
  - [ViewConfigurationCompat](https://developer.android.com/reference/android/support/v4/view/ViewConfigurationCompat)
  - [ViewGroupCompat](https://developer.android.com/reference/android/support/v4/view/ViewGroupCompat)
  - [ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager)
  - [ViewPager.LayoutParams](https://developer.android.com/reference/android/support/v4/view/ViewPager.LayoutParams)
  - [ViewPager.SavedState](https://developer.android.com/reference/android/support/v4/view/ViewPager.SavedState)
  - [ViewPager.SimpleOnPageChangeListener](https://developer.android.com/reference/android/support/v4/view/ViewPager.SimpleOnPageChangeListener)
  - [ViewParentCompat](https://developer.android.com/reference/android/support/v4/view/ViewParentCompat)
  - [ViewPropertyAnimatorCompat](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorCompat)
  - [ViewPropertyAnimatorListenerAdapter](https://developer.android.com/reference/android/support/v4/view/ViewPropertyAnimatorListenerAdapter)
  - [WindowCompat](https://developer.android.com/reference/android/support/v4/view/WindowCompat)
  - [WindowInsetsCompat](https://developer.android.com/reference/android/support/v4/view/WindowInsetsCompat)