Example usage for Java android.view ViewGroup fields, constructors, methods, implement or subclass
The text is from its open source code.
int | FOCUS_BEFORE_DESCENDANTS This view will get focus before any of its descendants. |
int | FOCUS_AFTER_DESCENDANTS This view will get focus only if none of its descendants want it. |
int | FOCUS_BLOCK_DESCENDANTS This view will block any of its descendants from getting focus, even if they are focusable. |
int | PERSISTENT_ANIMATION_CACHE Used to indicate that the animation drawing cache should be kept in memory. |
int | PERSISTENT_SCROLLING_CACHE Used to indicate that the scrolling drawing cache should be kept in memory. |
int | PERSISTENT_ALL_CACHES Used to indicate that all drawing caches should be kept in memory. |
void | addOnAttachStateChangeListener(OnAttachStateChangeListener listener) Add a listener for attach state changes. |
void | addView(View child) Adds a child view. |
void | addView(View child, int width, int height) Adds a child view with this ViewGroup's default layout parameters and the specified width and height. |
void | addView(View child, int index, LayoutParams params) Adds a child view with the specified layout parameters. |
void | addView(View child, int index) Adds a child view. |
void | addView(View child, LayoutParams params) Adds a child view with the specified layout parameters. |
ViewPropertyAnimator | animate() This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View. |
void | bringChildToFront(View child) |
void | bringToFront() Change the view's z order in the tree, so it's on top of other sibling views. |
void | buildDrawingCache() Calling this method is equivalent to calling |
void | destroyDrawingCache() Frees the resources used by the drawing cache. |
boolean | dispatchTouchEvent(MotionEvent ev) |
void | endViewTransition(View view) This method should always be called following an earlier call to #startViewTransition(View) . |
T | findViewById(@IdRes int id) Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy. |
void | findViewsWithText(ArrayList |
T | findViewWithTag(Object tag) Look for a child view with the given tag. |
float | getAlpha() The opacity of the view. |
Drawable | getBackground() Gets the background drawable |
int | getBottom() Bottom position of this view relative to its parent. |
View | getChildAt(int index) Returns the view at the specified position in the group. |
int | getChildCount() Returns the number of children in the group. |
int | getChildMeasureSpec(int spec, int padding, int childDimension) Does the hard part of measureChildren: figuring out the MeasureSpec to pass to a particular child. |
Class> | getClass() Returns the runtime class of this Object . |
boolean | getClipChildren() Returns whether this group's children are clipped to their bounds before drawing. |
Context | getContext() Returns the context the view is running in, through which it can access the current theme, resources, etc. |
Bitmap | getDrawingCache() Calling this method is equivalent to calling |
Bitmap | getDrawingCache(boolean autoScale) Returns the bitmap in which this view drawing is cached. |
ArrayList | getFocusables(@FocusDirection int direction) Find and return all focusable views that are descendants of this view, possibly including this view if it is focusable itself. |
int | getHeight() Return the height of your view. |
int | getId() Returns this view's identifier. |
ViewGroup.LayoutParams | getLayoutParams() Get the LayoutParams associated with this view. |
LayoutTransition | getLayoutTransition() Gets the LayoutTransition object for this ViewGroup. |
int | getLeft() Left position of this view relative to its parent. |
void | getLocationInWindow(@Size(2) int[] outLocation) Computes the coordinates of this view in its window. |
void | getLocationOnScreen(@Size(2) int[] outLocation) Computes the coordinates of this view on the screen. |
int | getMeasuredHeight() Like #getMeasuredHeightAndState() , but only returns the raw height component (that is the result is masked by #MEASURED_SIZE_MASK ). |
int | getMeasuredWidth() Like #getMeasuredWidthAndState() , but only returns the raw width component (that is the result is masked by #MEASURED_SIZE_MASK ). |
int | getMinimumHeight() Returns the minimum height of the view. |
ViewGroupOverlay | getOverlay() Returns the ViewGroupOverlay for this view group, creating it if it does not yet exist. |
int | getPaddingBottom() Returns the bottom padding of this view. |
int | getPaddingLeft() Returns the left padding of this view. |
int | getPaddingRight() Returns the right padding of this view. |
int | getPaddingTop() Returns the top padding of this view. |
ViewParent | getParent() Gets the parent of this view. |
Resources | getResources() Returns the resources associated with this view. |
int | getRight() Right position of this view relative to its parent. |
float | getScaleX() The amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width. |
int | getScrollX() Return the scrolled left position of this view. |
int | getScrollY() Return the scrolled top position of this view. |
Object | getTag() Returns this view's tag. |
Object | getTag(int key) Returns the tag associated with this view and the specified key. |
int | getTop() Top position of this view relative to its parent. |
ArrayList | getTouchables() Find and return all touchable views that are descendants of this view, possibly including this view if it is touchable itself. |
float | getTranslationX() The horizontal location of this view relative to its #getLeft() left position. |
float | getTranslationY() The vertical location of this view relative to its #getTop() top position. |
ViewTreeObserver | getViewTreeObserver() Returns the ViewTreeObserver for this view's hierarchy. |
int | getVisibility() Returns the visibility status for this view. |
int | getWidth() Return the width of your view. |
void | getWindowVisibleDisplayFrame(Rect outRect) Retrieve the overall visible display size in which the window this view is attached to has been positioned in. |
boolean | hasFocus() Returns true if this view has or contains focus |
int | indexOfChild(View child) Returns the position in the group of the specified child view. |
void | invalidate() Invalidate the whole view. |
boolean | isLaidOut() Returns true if this view has been through at least one layout since it was last attached to or detached from a window. |
boolean | isSelected() Indicates the selection state of this view. |
boolean | isShown() Returns the visibility of this view and all of its ancestors |
void | layout(int l, int t, int r, int b) |
void | measure(int widthMeasureSpec, int heightMeasureSpec) This is called to find out how big a view should be. |
void | offsetDescendantRectToMyCoords(View descendant, Rect rect) Offset a rectangle that is in a descendant's coordinate space into our coordinate space. |
boolean | onInterceptTouchEvent(MotionEvent ev) Implement this method to intercept all touch screen motion events. |
boolean | onTouchEvent(MotionEvent event) Implement this method to handle touch screen motion events. |
boolean | post(Runnable action) Causes the Runnable to be added to the message queue. |
boolean | postDelayed(Runnable action, long delayMillis) Causes the Runnable to be added to the message queue, to be run after the specified amount of time elapses. |
void | postOnAnimationDelayed(Runnable action, long delayMillis) Causes the Runnable to execute on the next animation time step, after the specified amount of time elapses. |
void | removeAllViews() Call this method to remove all child views from the ViewGroup. |
void | removeAllViewsInLayout() Called by a ViewGroup subclass to remove child views from itself, when it must first know its size on screen before it can calculate how many child views it will render. |
void | removeView(View view) Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method. |
void | removeViewAt(int index) Removes the view at the specified position in the group. |
void | removeViewInLayout(View view) Removes a view during layout. |
void | removeViews(int start, int count) Removes the specified range of views from the group. |
void | requestChildFocus(View child, View focused) |
boolean | requestFocus() Call this to try to give focus to a specific view or to one of its descendants. |
void | requestLayout() Call this when something has changed which has invalidated the layout of this view. |
boolean | requestSendAccessibilityEvent(View child, AccessibilityEvent event) |
void | requestTransparentRegion(View child) |
void | setAccessibilityDelegate(@Nullable AccessibilityDelegate delegate) Sets a delegate for implementing accessibility support via composition (as opposed to inheritance). |
void | setActivated(boolean activated) Changes the activated state of this view. |
void | setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha) Sets the opacity of the view to a value from 0 to 1, where 0 means the view is completely transparent and 1 means the view is completely opaque. |
void | setAnimation(Animation animation) Sets the next animation to play for this view. |
void | setAnimationCacheEnabled(boolean enabled) Enables or disables the children's drawing cache during a layout animation. |
void | setBackground(Drawable background) Set the background to a given Drawable, or remove the background. |
void | setBackgroundColor(@ColorInt int color) Sets the background color for this view. |
void | setBackgroundDrawable(Drawable background) |
void | setBackgroundResource(@DrawableRes int resid) Set the background to a given resource. |
void | setClickable(boolean clickable) Enables or disables click events for this view. |
void | setClipChildren(boolean clipChildren) By default, children are clipped to their bounds before drawing. |
void | setClipToPadding(boolean clipToPadding) Sets whether this ViewGroup will clip its children to its padding and resize (but not clip) any EdgeEffect to the padded region, if padding is present. |
void | setContentDescription(CharSequence contentDescription) Sets the View 's content description. |
void | setDescendantFocusability(int focusability) Set the descendant focusability of this view group. |
void | setDrawingCacheEnabled(boolean enabled) Enables or disables the drawing cache. |
void | setDrawingCacheQuality(@DrawingCacheQuality int quality) Set the drawing cache quality of this view. |
void | setElevation(float elevation) Sets the base elevation of this view, in pixels. |
void | setEnabled(boolean enabled) Set the enabled state of this view. |
void | setFitsSystemWindows(boolean fitSystemWindows) Sets whether or not this view should account for system screen decorations such as the status bar and inset its content; that is, controlling whether the default implementation of #fitSystemWindows(Rect) will be executed. |
void | setFocusable(boolean focusable) Set whether this view can receive the focus. |
void | setFocusableInTouchMode(boolean focusableInTouchMode) Set whether this view can receive focus while in touch mode. |
void | setForeground(Drawable foreground) Supply a Drawable that is to be rendered on top of all of the content in the view. |
void | setId(@IdRes int id) Sets the identifier for this view. |
void | setKeepScreenOn(boolean keepScreenOn) Controls whether the screen should remain on, modifying the value of #KEEP_SCREEN_ON . |
void | setLayoutAnimation(LayoutAnimationController controller) Sets the layout animation controller used to animate the group's children after the first layout. |
void | setLayoutAnimationListener(Animation.AnimationListener animationListener) Specifies the animation listener to which layout animation events must be sent. |
void | setLayoutParams(ViewGroup.LayoutParams params) Set the layout parameters associated with this view. |
void | setLayoutTransition(LayoutTransition transition) Sets the LayoutTransition object for this ViewGroup. |
void | setMotionEventSplittingEnabled(boolean split) Enable or disable the splitting of MotionEvents to multiple children during touch event dispatch. |
void | setOnClickListener(@Nullable OnClickListener l) Register a callback to be invoked when this view is clicked. |
void | setOnHierarchyChangeListener(OnHierarchyChangeListener listener) Register a callback to be invoked when a child is added to or removed from this view. |
void | setOnLongClickListener(@Nullable OnLongClickListener l) Register a callback to be invoked when this view is clicked and held. |
void | setOnSystemUiVisibilityChangeListener(OnSystemUiVisibilityChangeListener l) Set a listener to receive callbacks when the visibility of the system bar changes. |
void | setOnTouchListener(OnTouchListener l) Register a callback to be invoked when a touch event is sent to this view. |
void | setPadding(int left, int top, int right, int bottom) Sets the padding. |
void | setPressed(boolean pressed) Sets the pressed state for this view. |
void | setScrollY(int value) Set the vertical scrolled position of your view. |
void | setSelected(boolean selected) Changes the selection state of this view. |
void | setTag(int key, final Object tag) Sets a tag associated with this view and a key. |
void | setTag(final Object tag) Sets the tag associated with this view. |
void | setTranslationY(float translationY) Sets the vertical location of this view relative to its #getTop() top position. |
void | setVisibility(@Visibility int visibility) Set the visibility state of this view. |
void | setWillNotDraw(boolean willNotDraw) If this view doesn't do any drawing on its own, set this flag to allow further optimizations. |
void | startAnimation(Animation animation) Start the specified animation now. |
void | startViewTransition(View view) This method tells the ViewGroup that the given View object, which should have this ViewGroup as its parent, should be kept around (re-displayed when the ViewGroup draws its children) even if it is removed from its parent. |