IT. Expert System.

Android Reference

ViewGroup


android.view

Class ViewGroup

    • Field Detail

      • mDisappearingChildren

        protected ArrayList<View> mDisappearingChildren
        Views which have been hidden or removed which need to be animated on their way out. This field should be made private, so it is hidden from the SDK.
      • mOnHierarchyChangeListener

        protected ViewGroup.OnHierarchyChangeListener mOnHierarchyChangeListener
        Listener used to propagate events indicating when children are added and/or removed from a view group. This field should be made private, so it is hidden from the SDK.
      • mGroupFlags

        protected int mGroupFlags
        Internal flags. This field should be made private, so it is hidden from the SDK.
      • FOCUS_BEFORE_DESCENDANTS

        public static final int FOCUS_BEFORE_DESCENDANTS
        This view will get focus before any of its descendants.
        See Also:
        Constant Field Values
      • FOCUS_AFTER_DESCENDANTS

        public static final int FOCUS_AFTER_DESCENDANTS
        This view will get focus only if none of its descendants want it.
        See Also:
        Constant Field Values
      • FOCUS_BLOCK_DESCENDANTS

        public static final int FOCUS_BLOCK_DESCENDANTS
        This view will block any of its descendants from getting focus, even if they are focusable.
        See Also:
        Constant Field Values
      • FLAG_DISALLOW_INTERCEPT

        protected static final int FLAG_DISALLOW_INTERCEPT
        When set, this ViewGroup should not intercept touch events.
        See Also:
        Constant Field Values
      • mPersistentDrawingCache

        protected int mPersistentDrawingCache
        Indicates which types of drawing caches are to be kept in memory. This field should be made private, so it is hidden from the SDK.
      • PERSISTENT_NO_CACHE

        public static final int PERSISTENT_NO_CACHE
        Used to indicate that no drawing cache should be kept in memory.
        See Also:
        Constant Field Values
      • PERSISTENT_ANIMATION_CACHE

        public static final int PERSISTENT_ANIMATION_CACHE
        Used to indicate that the animation drawing cache should be kept in memory.
        See Also:
        Constant Field Values
      • PERSISTENT_SCROLLING_CACHE

        public static final int PERSISTENT_SCROLLING_CACHE
        Used to indicate that the scrolling drawing cache should be kept in memory.
        See Also:
        Constant Field Values
      • PERSISTENT_ALL_CACHES

        public static final int PERSISTENT_ALL_CACHES
        Used to indicate that all drawing caches should be kept in memory.
        See Also:
        Constant Field Values
      • OPTICAL_BOUNDS

        public static final int 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.
        See Also:
        Constant Field Values
      • CLIP_TO_PADDING_MASK

        protected static final int CLIP_TO_PADDING_MASK
        We clip to padding when FLAG_CLIP_TO_PADDING and FLAG_PADDING_NOT_NULL are set at the same time.
        See Also:
        Constant Field Values
    • Method Detail

      • requestChildFocus

        public void requestChildFocus(View child,
                             View focused)
        Called when a child of this parent wants focus
        Specified by:
        requestChildFocus in interface ViewParent
        Parameters:
        child - The child of this ViewParent that wants focus. This view will contain the focused view. It is not necessarily the view that actually has focus.
        focused - The view that is a descendant of child that actually has focus
      • focusableViewAvailable

        public void focusableViewAvailable(View v)
        Tells the parent that a new focusable view has become available. This is to handle transitions from the case where there are no focusable views to the case where the first focusable view appears.
        Specified by:
        focusableViewAvailable in interface ViewParent
        Parameters:
        v - The view that has become newly focusable
      • showContextMenuForChild

        public boolean showContextMenuForChild(View originalView)
        Bring up a context menu for the specified view or its ancestors.

        In most cases, a subclass does not need to override this. However, if the subclass is added directly to the window manager (for example, ViewManager.addView(View, android.view.ViewGroup.LayoutParams)) then it should override this and show the context menu.

        Specified by:
        showContextMenuForChild in interface ViewParent
        Parameters:
        originalView - The source view where the context menu was first invoked
        Returns:
        true if a context menu was displayed
      • startActionModeForChild

        public ActionMode startActionModeForChild(View originalView,
                                         ActionMode.Callback callback)
        Start an action mode for the specified view.

        In most cases, a subclass does not need to override this. However, if the subclass is added directly to the window manager (for example, ViewManager.addView(View, android.view.ViewGroup.LayoutParams)) then it should override this and start the action mode.

        Specified by:
        startActionModeForChild in interface ViewParent
        Parameters:
        originalView - The source view where the action mode was first invoked
        callback - The callback that will handle lifecycle events for the action mode
        Returns:
        The new action mode if it was started, null otherwise
      • focusSearch

        public View focusSearch(View focused,
                       int direction)
        Find the nearest view in the specified direction that wants to take focus.
        Specified by:
        focusSearch in interface ViewParent
        Parameters:
        focused - The view that currently has focus
        direction - One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT, or 0 for not applicable.
      • requestChildRectangleOnScreen

        public boolean requestChildRectangleOnScreen(View child,
                                            Rect rectangle,
                                            boolean immediate)
        Called when a child of this group wants a particular rectangle to be positioned onto the screen. ViewGroups overriding this can trust that:
        • child will be a direct child of this group
        • rectangle will be in the child's coordinates

        ViewGroups overriding this should uphold the contract:

        • nothing will change if the rectangle is already visible
        • the view port will be scrolled only just enough to make the rectangle visible
          Specified by:
          requestChildRectangleOnScreen in interface ViewParent
          Parameters:
          child - The direct child making the request.
          rectangle - The rectangle in the child's coordinates the child wishes to be on the screen.
          immediate - True to forbid animated or delayed scrolling, false otherwise
          Returns:
          Whether the group scrolled to handle the operation
        • requestSendAccessibilityEvent

          public boolean requestSendAccessibilityEvent(View child,
                                              AccessibilityEvent event)
          Called by a child to request from its parent to send an AccessibilityEvent. The child has already populated a record for itself in the event and is delegating to its parent to send the event. The parent can optionally add a record for itself.

          Note: An accessibility event is fired by an individual view which populates the event with a record for its state and requests from its parent to perform the sending. The parent can optionally add a record for itself before dispatching the request to its parent. A parent can also choose not to respect the request for sending the event. The accessibility event is sent by the topmost view in the view tree.

          Specified by:
          requestSendAccessibilityEvent in interface ViewParent
          Parameters:
          child - The child which requests sending the event.
          event - The event to be sent.
          Returns:
          True if the event was sent.
        • childHasTransientStateChanged

          public void childHasTransientStateChanged(View child,
                                           boolean childHasTransientState)
          Called when a child view has changed whether or not it is tracking transient state.
          Specified by:
          childHasTransientStateChanged in interface ViewParent
          Parameters:
          child - Child view whose state has changed
          childHasTransientState - true if this child has transient state
        • hasTransientState

          public boolean hasTransientState()
          Description copied from class: View
          Indicates whether the view is currently tracking transient state that the app should not need to concern itself with saving and restoring, but that the framework should take special note to preserve when possible.

          A view with transient state cannot be trivially rebound from an external data source, such as an adapter binding item views in a list. This may be because the view is performing an animation, tracking user selection of content, or similar.

          Overrides:
          hasTransientState in class View
          Returns:
          true if the view has transient state
        • dispatchUnhandledMove

          public boolean dispatchUnhandledMove(View focused,
                                      int direction)
          This method is the last chance for the focused view and its ancestors to respond to an arrow key. This is called when the focused view did not consume the key internally, nor could the view system find a new view in the requested direction to give focus to.
          Overrides:
          dispatchUnhandledMove in class View
          Parameters:
          focused - The currently focused view.
          direction - The direction focus wants to move. One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT.
          Returns:
          True if the this view consumed this unhandled move.
        • clearChildFocus

          public void clearChildFocus(View child)
          Called when a child of this parent is giving up focus
          Specified by:
          clearChildFocus in interface ViewParent
          Parameters:
          child - The view that is giving up focus
        • clearFocus

          public void clearFocus()
          Called when this view wants to give up focus. If focus is cleared View.onFocusChanged(boolean, int, android.graphics.Rect) is called.

          Note: When a View clears focus the framework is trying to give focus to the first focusable View from the top. Hence, if this View is the first from the top that can take focus, then all callbacks related to clearing focus will be invoked after wich the framework will give focus to this view.

          Overrides:
          clearFocus in class View
        • getFocusedChild

          public View getFocusedChild()
          Returns the focused child of this view, if any. The child may have focus or contain focus.
          Returns:
          the focused child or null.
        • hasFocus

          public boolean hasFocus()
          Returns true if this view has or contains focus
          Overrides:
          hasFocus in class View
          Returns:
          true if this view has or contains focus
        • findFocus

          public View findFocus()
          Description copied from class: View
          Find the view in the hierarchy rooted at this view that currently has focus.
          Overrides:
          findFocus in class View
          Returns:
          The view that currently has focus, or null if no focused view can be found.
        • hasFocusable

          public boolean hasFocusable()
          Returns true if this view is focusable or if it contains a reachable View for which View.hasFocusable() returns true. A "reachable hasFocusable()" is a View whose parents do not block descendants focus. Only View.VISIBLE views are considered focusable.
          Overrides:
          hasFocusable in class View
          Returns:
          True if the view is focusable or if the view contains a focusable View, false otherwise.
          See Also:
          FOCUS_BLOCK_DESCENDANTS
        • addFocusables

          public void addFocusables(ArrayList<View> views,
                           int direction,
                           int focusableMode)
          Adds any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. This method adds all focusable views regardless if we are in touch mode or only views focusable in touch mode if we are in touch mode or only views that can take accessibility focus if accessibility is enabeld depending on the focusable mode paramater.
          Overrides:
          addFocusables in class View
          Parameters:
          views - Focusable views found so far or null if all we are interested is the number of focusables.
          direction - The direction of the focus.
          focusableMode - The type of focusables to be added.
          See Also:
          View.FOCUSABLES_ALL, View.FOCUSABLES_TOUCH_MODE
        • dispatchWindowFocusChanged

          public void dispatchWindowFocusChanged(boolean hasFocus)
          Called when the window containing this view gains or loses window focus. ViewGroups should override to route to their children.
          Overrides:
          dispatchWindowFocusChanged in class View
          Parameters:
          hasFocus - True if the window containing this view now has focus, false otherwise.
        • addTouchables

          public void addTouchables(ArrayList<View> views)
          Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.
          Overrides:
          addTouchables in class View
          Parameters:
          views - Touchable views found so far
        • makeOptionalFitsSystemWindows

          public void makeOptionalFitsSystemWindows()
          Description copied from class: View
          For use by PhoneWindow to make its own system window fitting optional.
          Overrides:
          makeOptionalFitsSystemWindows in class View
        • dispatchDisplayHint

          public void dispatchDisplayHint(int hint)
          Dispatch a hint about whether this view is displayed. For instance, when a View moves out of the screen, it might receives a display hint indicating the view is not displayed. Applications should not rely on this hint as there is no guarantee that they will receive one.
          Overrides:
          dispatchDisplayHint in class View
          Parameters:
          hint - A hint about whether or not this view is displayed: View.VISIBLE or View.INVISIBLE.
        • onChildVisibilityChanged

          protected void onChildVisibilityChanged(View child,
                                      int oldVisibility,
                                      int newVisibility)
          Called when a view's visibility has changed. Notify the parent to take any appropriate action.
          Parameters:
          child - The view whose visibility has changed
          oldVisibility - The previous visibility value (GONE, INVISIBLE, or VISIBLE).
          newVisibility - The new visibility value (GONE, INVISIBLE, or VISIBLE).
        • dispatchVisibilityChanged

          protected void dispatchVisibilityChanged(View changedView,
                                       int visibility)
          Dispatch a view visibility change down the view hierarchy. ViewGroups should override to route to their children.
          Overrides:
          dispatchVisibilityChanged in class View
          Parameters:
          changedView - The view whose visibility changed. Could be 'this' or an ancestor view.
          visibility - The new visibility of changedView: View.VISIBLE, View.INVISIBLE or View.GONE.
        • dispatchWindowVisibilityChanged

          public void dispatchWindowVisibilityChanged(int visibility)
          Dispatch a window visibility change down the view hierarchy. ViewGroups should override to route to their children.
          Overrides:
          dispatchWindowVisibilityChanged in class View
          Parameters:
          visibility - The new visibility of the window.
          See Also:
          View.onWindowVisibilityChanged(int)
        • recomputeViewAttributes

          public void recomputeViewAttributes(View child)
          Tell view hierarchy that the global view attributes need to be re-evaluated.
          Specified by:
          recomputeViewAttributes in interface ViewParent
          Parameters:
          child - View whose attributes have changed.
        • bringChildToFront

          public void bringChildToFront(View child)
          Change the z order of the child so it's on top of all other children
          Specified by:
          bringChildToFront in interface ViewParent
        • dispatchDragEvent

          public boolean dispatchDragEvent(DragEvent event)
          Detects if this View is enabled and has a drag event listener. If both are true, then it calls the drag event listener with the DragEvent it received. If the drag event listener returns true, then dispatchDragEvent() returns true.

          For all other cases, the method calls the onDragEvent() drag event handler method and returns its result.

          This ensures that a drag event is always consumed, even if the View does not have a drag event listener. However, if the View has a listener and the listener returns true, then onDragEvent() is not called.

          Overrides:
          dispatchDragEvent in class View
        • dispatchKeyEventPreIme

          public boolean dispatchKeyEventPreIme(KeyEvent event)
          Dispatch a key event before it is processed by any input method associated with the view hierarchy. This can be used to intercept key events in special situations before the IME consumes them; a typical example would be handling the BACK key to update the application's UI instead of allowing the IME to see it and close itself.
          Overrides:
          dispatchKeyEventPreIme in class View
          Parameters:
          event - The key event to be dispatched.
          Returns:
          True if the event was handled, false otherwise.
        • dispatchKeyEvent

          public boolean dispatchKeyEvent(KeyEvent event)
          Dispatch a key event to the next view on the focus path. This path runs from the top of the view tree down to the currently focused view. If this view has focus, it will dispatch to itself. Otherwise it will dispatch the next node down the focus path. This method also fires any key listeners.
          Overrides:
          dispatchKeyEvent in class View
          Parameters:
          event - The key event to be dispatched.
          Returns:
          True if the event was handled, false otherwise.
        • dispatchKeyShortcutEvent

          public boolean dispatchKeyShortcutEvent(KeyEvent event)
          Dispatches a key shortcut event.
          Overrides:
          dispatchKeyShortcutEvent in class View
          Parameters:
          event - The key event to be dispatched.
          Returns:
          True if the event was handled by the view, false otherwise.
        • dispatchTrackballEvent

          public boolean dispatchTrackballEvent(MotionEvent event)
          Pass a trackball motion event down to the focused view.
          Overrides:
          dispatchTrackballEvent in class View
          Parameters:
          event - The motion event to be dispatched.
          Returns:
          True if the event was handled by the view, false otherwise.
        • hasHoveredChild

          protected boolean hasHoveredChild()
          Description copied from class: View
          Returns true if the view has a child to which it has recently sent MotionEvent.ACTION_HOVER_ENTER. If this view is hovered and it does not have a hovered child, then it must be the innermost hovered view.
          Overrides:
          hasHoveredChild in class View
        • addChildrenForAccessibility

          public void addChildrenForAccessibility(ArrayList<View> childrenForAccessibility)
          Description copied from class: View
          Adds the children of a given View for accessibility. Since some Views are not important for accessibility the children for accessibility are not necessarily direct children of the riew, rather they are the first level of descendants important for accessibility.
          Overrides:
          addChildrenForAccessibility in class View
          Parameters:
          childrenForAccessibility - The list of children for accessibility.
        • childAccessibilityStateChanged

          public void childAccessibilityStateChanged(View child)
          Description copied from interface: ViewParent
          A child notifies its parent that its state for accessibility has changed. That is some of the child properties reported to accessibility services has changed, hence the interested services have to be notified for the new state.
          Specified by:
          childAccessibilityStateChanged in interface ViewParent
        • onInterceptHoverEvent

          public boolean onInterceptHoverEvent(MotionEvent event)
          Implement this method to intercept hover events before they are handled by child views.

          This method is called before dispatching a hover event to a child of the view group or to the view group's own View.onHoverEvent(android.view.MotionEvent) to allow the view group a chance to intercept the hover event. This method can also be used to watch all pointer motions that occur within the bounds of the view group even when the pointer is hovering over a child of the view group rather than over the view group itself.

          The view group can prevent its children from receiving hover events by implementing this method and returning true to indicate that it would like to intercept hover events. The view group must continuously return true from onInterceptHoverEvent(android.view.MotionEvent) for as long as it wishes to continue intercepting hover events from its children.

          Interception preserves the invariant that at most one view can be hovered at a time by transferring hover focus from the currently hovered child to the view group or vice-versa as needed.

          If this method returns true and a child is already hovered, then the child view will first receive a hover exit event and then the view group itself will receive a hover enter event in View.onHoverEvent(android.view.MotionEvent). Likewise, if this method had previously returned true to intercept hover events and instead returns false while the pointer is hovering within the bounds of one of a child, then the view group will first receive a hover exit event in View.onHoverEvent(android.view.MotionEvent) and then the hovered child will receive a hover enter event.

          The default implementation always returns false.

          Parameters:
          event - The motion event that describes the hover.
          Returns:
          True if the view group would like to intercept the hover event and prevent its children from receiving it.
        • dispatchGenericPointerEvent

          protected boolean dispatchGenericPointerEvent(MotionEvent event)
          Dispatch a generic motion event to the view under the first pointer.

          Do not call this method directly. Call View.dispatchGenericMotionEvent(MotionEvent) instead.

          Overrides:
          dispatchGenericPointerEvent in class View
          Parameters:
          event - The motion event to be dispatched.
          Returns:
          True if the event was handled by the view, false otherwise.
        • dispatchTouchEvent

          public boolean dispatchTouchEvent(MotionEvent ev)
          Pass the touch screen motion event down to the target view, or this view if it is the target.
          Overrides:
          dispatchTouchEvent in class View
          Parameters:
          ev - The motion event to be dispatched.
          Returns:
          True if the event was handled by the view, false otherwise.
        • isTransformedTouchPointInView

          protected boolean isTransformedTouchPointInView(float x,
                                              float y,
                                              View child,
                                              PointF outLocalPoint)
          Returns true if a child view contains the specified point when transformed into its coordinate space. Child must not be null.
        • setMotionEventSplittingEnabled

          public void setMotionEventSplittingEnabled(boolean split)
          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 Build.VERSION_CODES#HONEYCOMB or newer.

          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:
          split - 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.
        • isMotionEventSplittingEnabled

          public boolean isMotionEventSplittingEnabled()
          Returns true if MotionEvents dispatched to this ViewGroup can be split to multiple children.
          Returns:
          true if MotionEvents dispatched to this ViewGroup can be split to multiple children.
        • requestDisallowInterceptTouchEvent

          public void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
          Called when a child does not want this parent and its ancestors to intercept touch events with onInterceptTouchEvent(MotionEvent).

          This parent should pass this call onto its parents. This parent must obey this request for the duration of the touch (that is, only clear the flag after this parent has received an up or a cancel.

          Specified by:
          requestDisallowInterceptTouchEvent in interface ViewParent
          Parameters:
          disallowIntercept - True if the child does not want the parent to intercept touch events.
        • onInterceptTouchEvent

          public boolean onInterceptTouchEvent(MotionEvent ev)
          Implement this method to intercept all touch screen motion events. This allows you to watch events as they are dispatched to your children, and take ownership of the current gesture at any point.

          Using this function takes some care, as it has a fairly complicated interaction with View.onTouchEvent(MotionEvent), and using it requires implementing that method as well as this one in the correct way. Events will be received in the following order:

          1. You will receive the down event here.
          2. The down event will be handled either by a child of this view group, or given to your own onTouchEvent() method to handle; this means you should implement onTouchEvent() to return true, so you will continue to see the rest of the gesture (instead of looking for a parent view to handle it). Also, by returning true from onTouchEvent(), you will not receive any following events in onInterceptTouchEvent() and all touch processing must happen in onTouchEvent() like normal.
          3. For as long as you return false from this function, each following event (up to and including the final up) will be delivered first here and then to the target's onTouchEvent().
          4. If you return true from here, you will not receive any following events: the target view will receive the same event but with the action MotionEvent.ACTION_CANCEL, and all further events will be delivered to your onTouchEvent() method and no longer appear here.
          Parameters:
          ev - The motion event being dispatched down the hierarchy.
          Returns:
          Return true to steal motion events from the children and have them dispatched to this ViewGroup through onTouchEvent(). The current target will receive an ACTION_CANCEL event, and no further messages will be delivered here.
        • requestFocus

          public boolean requestFocus(int direction,
                             Rect previouslyFocusedRect)
          Call this to try to give focus to a specific view or to one of its descendants and give it hints about the direction and a specific rectangle that the focus is coming from. The rectangle can help give larger views a finer grained hint about where focus is coming from, and therefore, where to show selection, or forward focus change internally. A view will not actually take focus if it is not focusable (View.isFocusable() returns false), or if it is focusable and it is not focusable in touch mode (View.isFocusableInTouchMode()) while the device is in touch mode. A View will not take focus if it is not visible. A View will not take focus if one of its parents has getDescendantFocusability() equal to FOCUS_BLOCK_DESCENDANTS. See also View.focusSearch(int), which is what you call to say that you have focus, and you want your parent to look for the next one. You may wish to override this method if your custom View has an internal View that it wishes to forward the request to. Looks for a view to give focus to respecting the setting specified by getDescendantFocusability(). Uses onRequestFocusInDescendants(int, android.graphics.Rect) to find focus within the children of this group when appropriate.
          Overrides:
          requestFocus in class View
          Parameters:
          direction - One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT
          previouslyFocusedRect - The rectangle (in this View's coordinate system) to give a finer grained hint about where focus is coming from. May be null if there is no hint.
          Returns:
          Whether this view or one of its descendants actually took focus.
          See Also:
          FOCUS_BEFORE_DESCENDANTS, FOCUS_AFTER_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, onRequestFocusInDescendants(int, android.graphics.Rect)
        • onRequestFocusInDescendants

          protected boolean onRequestFocusInDescendants(int direction,
                                            Rect previouslyFocusedRect)
          Look for a descendant to call View.requestFocus() on. Called by requestFocus(int, android.graphics.Rect) when it wants to request focus within its children. Override this to customize how your ViewGroup requests focus within its children.
          Parameters:
          direction - One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT
          previouslyFocusedRect - The rectangle (in this View's coordinate system) to give a finer grained hint about where focus is coming from. May be null if there is no hint.
          Returns:
          Whether focus was taken.
        • resetAccessibilityStateChanged

          public void resetAccessibilityStateChanged()
          Description copied from class: View
          Reset the state indicating the this view has requested clients interested in its accessibility state to be notified.
          Overrides:
          resetAccessibilityStateChanged in class View
        • internalSetPadding

          protected void internalSetPadding(int left,
                                int top,
                                int right,
                                int bottom)
          Overrides:
          internalSetPadding in class View
        • setChildrenDrawingCacheEnabled

          protected void setChildrenDrawingCacheEnabled(boolean enabled)
          Enables or disables the drawing cache for each child of this view group.
          Parameters:
          enabled - true to enable the cache, false to dispose of it
        • onDebugDrawMargins

          protected void onDebugDrawMargins(Canvas canvas)
        • onDebugDraw

          protected void onDebugDraw(Canvas canvas)
        • dispatchDraw

          protected void dispatchDraw(Canvas canvas)
          Called by draw to draw the child views. This may be overridden by derived classes to gain control just before its children are drawn (but after its own view has been drawn).
          Overrides:
          dispatchDraw in class View
          Parameters:
          canvas - the canvas on which to draw the view
        • dispatchGetDisplayList

          protected void dispatchGetDisplayList()
          This method is used to cause children of this ViewGroup to restore or recreate their display lists. It is called by getDisplayList() when the parent ViewGroup does not need to recreate its own display list, which would happen if it went through the normal draw/dispatchDraw mechanisms.
          Overrides:
          dispatchGetDisplayList in class View
        • drawChild

          protected boolean drawChild(Canvas canvas,
                          View child,
                          long drawingTime)
          Draw one child of this View Group. This method is responsible for getting the canvas in the right state. This includes clipping, translating so that the child's scrolled origin is at 0, 0, and applying any animation transformations.
          Parameters:
          canvas - The canvas on which to draw the child
          child - Who to draw
          drawingTime - The time at which draw is occurring
          Returns:
          True if an invalidate() was issued
        • setClipChildren

          public void setClipChildren(boolean clipChildren)
          By default, children are clipped to their bounds before drawing. This allows view groups to override this behavior for animations, etc.
          Parameters:
          clipChildren - true to clip children to their bounds, false otherwise
        • setClipToPadding

          public void setClipToPadding(boolean clipToPadding)
          By default, children are clipped to the padding of the ViewGroup. This allows view groups to override this behavior
          Parameters:
          clipToPadding - true to clip children to the padding of the group, false otherwise
        • dispatchSetSelected

          public void dispatchSetSelected(boolean selected)
          Dispatch setSelected to all of this View's children.
          Overrides:
          dispatchSetSelected in class View
          Parameters:
          selected - The new selected state
          See Also:
          View.setSelected(boolean)
        • dispatchSetActivated

          public void dispatchSetActivated(boolean activated)
          Dispatch setActivated to all of this View's children.
          Overrides:
          dispatchSetActivated in class View
          Parameters:
          activated - The new activated state
          See Also:
          View.setActivated(boolean)
        • dispatchSetPressed

          protected void dispatchSetPressed(boolean pressed)
          Description copied from class: View
          Dispatch setPressed to all of this View's children.
          Overrides:
          dispatchSetPressed in class View
          Parameters:
          pressed - The new pressed state
          See Also:
          View.setPressed(boolean)
        • getChildStaticTransformation

          protected boolean getChildStaticTransformation(View child,
                                             Transformation t)
          Sets t to be the static transformation of the child, if set, returning a boolean to indicate whether a static transform was set. The default implementation simply returns false; subclasses may override this method for different behavior. setStaticTransformationsEnabled(boolean) must be set to true for this method to be called.
          Parameters:
          child - The child view whose static transform is being requested
          t - The Transformation which will hold the result
          Returns:
          true if the transformation was set, false otherwise
          See Also:
          setStaticTransformationsEnabled(boolean)
        • findViewTraversal

          protected View findViewTraversal(int id)
          Overrides:
          findViewTraversal in class View
          Parameters:
          id - the id of the view to be found
          Returns:
          the view of the specified id, null if cannot be found
        • findViewWithTagTraversal

          protected View findViewWithTagTraversal(Object tag)
          Overrides:
          findViewWithTagTraversal in class View
          Parameters:
          tag - the tag of the view to be found
          Returns:
          the view of specified tag, null if cannot be found
        • findViewByPredicateTraversal

          protected View findViewByPredicateTraversal(com.android.internal.util.Predicate<View> predicate,
                                          View childToSkip)
          Overrides:
          findViewByPredicateTraversal in class View
          Parameters:
          predicate - The predicate to evaluate.
          childToSkip - If not null, ignores this child during the recursive traversal.
          Returns:
          The first view that matches the predicate or null.
        • setOnHierarchyChangeListener

          public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
          Register a callback to be invoked when a child is added to or removed from this view.
          Parameters:
          listener - the callback to invoke on hierarchy change
        • onViewAdded

          protected void onViewAdded(View child)
        • onViewRemoved

          protected void onViewRemoved(View child)
        • addViewInLayout

          protected boolean addViewInLayout(View child,
                                int index,
                                ViewGroup.LayoutParams params)
          Adds a view during layout. This is useful if in your onLayout() method, you need to add more views (as does the list view for example). If index is negative, it means put it at the end of the list.
          Parameters:
          child - the view to add to the group
          index - the index at which the child must be added
          params - the layout parameters to associate with the child
          Returns:
          true if the child was added, false otherwise
        • addViewInLayout

          protected boolean addViewInLayout(View child,
                                int index,
                                ViewGroup.LayoutParams params,
                                boolean preventRequestLayout)
          Adds a view during layout. This is useful if in your onLayout() method, you need to add more views (as does the list view for example). If index is negative, it means put it at the end of the list.
          Parameters:
          child - the view to add to the group
          index - the index at which the child must be added
          params - the layout parameters to associate with the child
          preventRequestLayout - if true, calling this method will not trigger a layout request on child
          Returns:
          true if the child was added, false otherwise
        • cleanupLayoutState

          protected void cleanupLayoutState(View child)
          Prevents the specified child to be laid out during the next layout pass.
          Parameters:
          child - the child on which to perform the cleanup
        • attachLayoutAnimationParameters

          protected void attachLayoutAnimationParameters(View child,
                                             ViewGroup.LayoutParams params,
                                             int index,
                                             int count)
          Subclasses should override this method to set layout animation parameters on the supplied child.
          Parameters:
          child - the child to associate with animation parameters
          params - the child's layout parameters which hold the animation parameters
          index - the index of the child in the view group
          count - the number of children in the view group
        • setLayoutTransition

          public void setLayoutTransition(LayoutTransition transition)
          Sets the LayoutTransition object for this ViewGroup. If the LayoutTransition object is not null, changes in layout which occur because of children being added to or removed from the ViewGroup will be animated according to the animations defined in that LayoutTransition object. By default, the transition object is null (so layout changes are not animated).
          Parameters:
          transition - The LayoutTransition object that will animated changes in layout. A value of null means no transition will run on layout changes.
        • getLayoutTransition

          public LayoutTransition getLayoutTransition()
          Gets the LayoutTransition object for this ViewGroup. If the LayoutTransition object is not null, changes in layout which occur because of children being added to or removed from the ViewGroup will be animated according to the animations defined in that LayoutTransition object. By default, the transition object is null (so layout changes are not animated).
          Returns:
          LayoutTranstion The LayoutTransition object that will animated changes in layout. A value of null means no transition will run on layout changes.
        • removeAllViewsInLayout

          public 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. An example is a Gallery or a ListView, which may "have" 50 children, but actually only render the number of children that can currently fit inside the object on screen. Do not call this method unless you are extending ViewGroup and understand the view measuring and layout pipeline.

          Note: do not invoke this method from View.draw(android.graphics.Canvas), View.onDraw(android.graphics.Canvas), dispatchDraw(android.graphics.Canvas) or any related method.

        • attachViewToParent

          protected void attachViewToParent(View child,
                                int index,
                                ViewGroup.LayoutParams params)
          Attaches a view to this view group. Attaching a view assigns this group as the parent, sets the layout parameters and puts the view in the list of children so that it can be retrieved by calling getChildAt(int).

          This method is intended to be lightweight and makes no assumptions about whether the parent or child should be redrawn. Proper use of this method will include also making any appropriate View.requestLayout() or View.invalidate() calls. For example, callers can post a Runnable which performs a View.requestLayout() on the next frame, after all detach/attach calls are finished, causing layout to be run prior to redrawing the view hierarchy.

          This method should be called only for views which were detached from their parent.

          Parameters:
          child - the child to attach
          index - the index at which the child should be attached
          params - the layout parameters of the child
          See Also:
          removeDetachedView(View, boolean), detachAllViewsFromParent(), detachViewFromParent(View), detachViewFromParent(int)
        • invalidateChild

          public final void invalidateChild(View child,
                             Rect dirty)
          Don't call or override this method. It is used for the implementation of the view hierarchy.
          Specified by:
          invalidateChild in interface ViewParent
          Parameters:
          child - The child which is dirty
          dirty - The area within the child that is invalid
        • invalidateChildInParent

          public ViewParent invalidateChildInParent(int[] location,
                                           Rect dirty)
          Don't call or override this method. It is used for the implementation of the view hierarchy. This implementation returns null if this ViewGroup does not have a parent, if this ViewGroup is already fully invalidated or if the dirty rectangle does not intersect with this ViewGroup's bounds.
          Specified by:
          invalidateChildInParent in interface ViewParent
          Parameters:
          location - An array of 2 ints containing the left and top coordinates of the child to invalidate
          dirty - The area within the child that is invalid
          Returns:
          the parent of this ViewParent or null
        • invalidateChildFast

          public void invalidateChildFast(View child,
                                 Rect dirty)
          Quick invalidation method called by View.invalidateViewProperty. This doesn't set the DRAWN flags and doesn't handle the Animation logic that the default invalidation methods do; all we want to do here is schedule a traversal with the appropriate dirty rect.
        • offsetDescendantRectToMyCoords

          public final void offsetDescendantRectToMyCoords(View descendant,
                                            Rect rect)
          Offset a rectangle that is in a descendant's coordinate space into our coordinate space.
          Parameters:
          descendant - A descendant of this view
          rect - A rectangle defined in descendant's coordinate space.
        • offsetRectIntoDescendantCoords

          public final void offsetRectIntoDescendantCoords(View descendant,
                                            Rect rect)
          Offset a rectangle that is in our coordinate space into an ancestor's coordinate space.
          Parameters:
          descendant - A descendant of this view
          rect - A rectangle defined in descendant's coordinate space.
        • offsetChildrenTopAndBottom

          public void offsetChildrenTopAndBottom(int offset)
          Offset the vertical location of all children of this view by the specified number of pixels.
          Parameters:
          offset - the number of pixels to offset
        • getChildVisibleRect

          public boolean getChildVisibleRect(View child,
                                    Rect r,
                                    Point offset)
          Compute the visible part of a rectangular region defined in terms of a child view's coordinates.

          Returns the clipped visible part of the rectangle r, defined in the child's local coordinate system. r is modified by this method to contain the result, expressed in the global (root) coordinate system.

          The resulting rectangle is always axis aligned. If a rotation is applied to a node in the View hierarchy, the result is the axis-aligned bounding box of the visible rectangle.

          Specified by:
          getChildVisibleRect in interface ViewParent
          Parameters:
          child - A child View, whose rectangular visible region we want to compute
          r - The input rectangle, defined in the child coordinate system. Will be overwritten to contain the resulting visible rectangle, expressed in global (root) coordinates
          offset - The input coordinates of a point, defined in the child coordinate system. As with the r parameter, this will be overwritten to contain the global (root) coordinates of that point. A null value is valid (in case you are not interested in this result)
          Returns:
          true if the resulting rectangle is not empty, false otherwise
        • layout

          public final void layout(int l,
                    int t,
                    int r,
                    int b)
          Assign a size and position to a view and all of its descendants

          This is the second phase of the layout mechanism. (The first is measuring). In this phase, each parent calls layout on all of its children to position them. This is typically done using the child measurements that were stored in the measure pass().

          Derived classes should not override this method. Derived classes with children should override onLayout. In that method, they should call layout on each of their children.

          Overrides:
          layout in class View
          Parameters:
          l - Left position, relative to parent
          t - Top position, relative to parent
          r - Right position, relative to parent
          b - Bottom position, relative to parent
        • onLayout

          protected abstract void onLayout(boolean changed,
                      int l,
                      int t,
                      int r,
                      int b)
          Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.
          Overrides:
          onLayout in class View
          Parameters:
          changed - This is a new size or position for this view
          l - Left position, relative to parent
          t - Top position, relative to parent
          r - Right position, relative to parent
          b - Bottom position, relative to parent
        • canAnimate

          protected boolean canAnimate()
          Indicates whether the view group has the ability to animate its children after the first layout.
          Returns:
          true if the children can be animated, false otherwise
        • startLayoutAnimation

          public void startLayoutAnimation()
          Runs the layout animation. Calling this method triggers a relayout of this view group.
        • scheduleLayoutAnimation

          public void scheduleLayoutAnimation()
          Schedules the layout animation to be played after the next layout pass of this view group. This can be used to restart the layout animation when the content of the view group changes or when the activity is paused and resumed.
        • setLayoutAnimation

          public void setLayoutAnimation(LayoutAnimationController controller)
          Sets the layout animation controller used to animate the group's children after the first layout.
          Parameters:
          controller - the animation controller
        • getLayoutAnimation

          public LayoutAnimationController getLayoutAnimation()
          Returns the layout animation controller used to animate the group's children.
          Returns:
          the current animation controller
        • isAnimationCacheEnabled

          public boolean isAnimationCacheEnabled()
          Indicates whether the children's drawing cache is used during a layout animation. By default, the drawing cache is enabled but this will prevent nested layout animations from working. To nest animations, you must disable the cache.
          Returns:
          true if the animation cache is enabled, false otherwise
          See Also:
          setAnimationCacheEnabled(boolean), View.setDrawingCacheEnabled(boolean)
        • setAnimationCacheEnabled

          public void setAnimationCacheEnabled(boolean enabled)
          Enables or disables the children's drawing cache during a layout animation. By default, the drawing cache is enabled but this will prevent nested layout animations from working. To nest animations, you must disable the cache.
          Parameters:
          enabled - true to enable the animation cache, false otherwise
          See Also:
          isAnimationCacheEnabled(), View.setDrawingCacheEnabled(boolean)
        • setAlwaysDrawnWithCacheEnabled

          public void setAlwaysDrawnWithCacheEnabled(boolean always)
          Indicates whether this ViewGroup will always try to draw its children using their drawing cache. This property can be set to true when the cache rendering is slightly different from the children's normal rendering. Renderings can be different, for instance, when the cache's quality is set to low. When this property is disabled, the ViewGroup will use the drawing cache of its children only when asked to. It's usually the task of subclasses to tell ViewGroup when to start using the drawing cache and when to stop using it.
          Parameters:
          always - true to always draw with the drawing cache, false otherwise
          See Also:
          isAlwaysDrawnWithCacheEnabled(), setChildrenDrawnWithCacheEnabled(boolean), View.setDrawingCacheEnabled(boolean), View.setDrawingCacheQuality(int)
        • setChildrenDrawnWithCacheEnabled

          protected void setChildrenDrawnWithCacheEnabled(boolean enabled)
          Tells the ViewGroup to draw its children using their drawing cache. This property is ignored when isAlwaysDrawnWithCacheEnabled() is true. A child's drawing cache will be used only if it has been enabled. Subclasses should call this method to start and stop using the drawing cache when they perform performance sensitive operations, like scrolling or animating.
          Parameters:
          enabled - true if children should be drawn with their cache, false otherwise
          See Also:
          setAlwaysDrawnWithCacheEnabled(boolean), isChildrenDrawnWithCacheEnabled()
        • getLayoutMode

          public int getLayoutMode()
          Returns the basis of alignment during layout operations on this view group: either CLIP_BOUNDS or OPTICAL_BOUNDS.
          Returns:
          the layout mode to use during layout operations
          See Also:
          setLayoutMode(int)
        • setLayoutMode

          public void setLayoutMode(int layoutMode)
          Sets the basis of alignment during the layout of this view group. Valid values are either CLIP_BOUNDS or OPTICAL_BOUNDS.

          The default is CLIP_BOUNDS.

          Parameters:
          layoutMode - the layout mode to use during layout operations
          See Also:
          getLayoutMode()
        • generateLayoutParams

          public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
          Returns a new set of layout parameters based on the supplied attributes set.
          Parameters:
          attrs - the attributes to build the layout parameters from
          Returns:
          an instance of ViewGroup.LayoutParams or one of its descendants
        • generateLayoutParams

          protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
          Returns a safe set of layout parameters based on the supplied layout params. When a ViewGroup is passed a View whose layout params do not pass the test of checkLayoutParams(android.view.ViewGroup.LayoutParams), this method is invoked. This method should return a new set of layout params suitable for this ViewGroup, possibly by copying the appropriate attributes from the specified set of layout params.
          Parameters:
          p - The layout parameters to convert into a suitable set of layout parameters for this ViewGroup.
          Returns:
          an instance of ViewGroup.LayoutParams or one of its descendants
        • generateDefaultLayoutParams

          protected ViewGroup.LayoutParams generateDefaultLayoutParams()
          Returns a set of default layout parameters. These parameters are requested when the View passed to addView(View) has no layout parameters already set. If null is returned, an exception is thrown from addView.
          Returns:
          a set of default layout parameters or null
        • debug

          protected void debug(int depth)
          Prints information about this view in the log output, with the tag View.VIEW_LOG_TAG. Each line in the output is preceded with an indentation defined by the depth.
          Overrides:
          debug in class View
          Parameters:
          depth - the indentation level
        • indexOfChild

          public int indexOfChild(View child)
          Returns the position in the group of the specified child view.
          Parameters:
          child - the view for which to get the position
          Returns:
          a positive integer representing the position of the view in the group, or -1 if the view does not exist in the group
        • getChildCount

          public int getChildCount()
          Returns the number of children in the group.
          Returns:
          a positive integer representing the number of children in the group
        • getChildAt

          public View getChildAt(int index)
          Returns the view at the specified position in the group.
          Parameters:
          index - the position at which to get the view from
          Returns:
          the view at the specified position or null if the position does not exist within the group
        • measureChildren

          protected void measureChildren(int widthMeasureSpec,
                             int heightMeasureSpec)
          Ask all of the children of this view to measure themselves, taking into account both the MeasureSpec requirements for this view and its padding. We skip children that are in the GONE state The heavy lifting is done in getChildMeasureSpec.
          Parameters:
          widthMeasureSpec - The width requirements for this view
          heightMeasureSpec - The height requirements for this view
        • measureChild

          protected void measureChild(View child,
                          int parentWidthMeasureSpec,
                          int parentHeightMeasureSpec)
          Ask one of the children of this view to measure itself, taking into account both the MeasureSpec requirements for this view and its padding. The heavy lifting is done in getChildMeasureSpec.
          Parameters:
          child - The child to measure
          parentWidthMeasureSpec - The width requirements for this view
          parentHeightMeasureSpec - The height requirements for this view
        • measureChildWithMargins

          protected void measureChildWithMargins(View child,
                                     int parentWidthMeasureSpec,
                                     int widthUsed,
                                     int parentHeightMeasureSpec,
                                     int heightUsed)
          Ask one of the children of this view to measure itself, taking into account both the MeasureSpec requirements for this view and its padding and margins. The child must have MarginLayoutParams The heavy lifting is done in getChildMeasureSpec.
          Parameters:
          child - The child to measure
          parentWidthMeasureSpec - The width requirements for this view
          widthUsed - Extra space that has been used up by the parent horizontally (possibly by other children of the parent)
          parentHeightMeasureSpec - The height requirements for this view
          heightUsed - Extra space that has been used up by the parent vertically (possibly by other children of the parent)
        • getChildMeasureSpec

          public static int getChildMeasureSpec(int spec,
                                int padding,
                                int childDimension)
          Does the hard part of measureChildren: figuring out the MeasureSpec to pass to a particular child. This method figures out the right MeasureSpec for one dimension (height or width) of one child view. The goal is to combine information from our MeasureSpec with the LayoutParams of the child to get the best possible results. For example, if the this view knows its size (because its MeasureSpec has a mode of EXACTLY), and the child has indicated in its LayoutParams that it wants to be the same size as the parent, the parent should ask the child to layout given an exact size.
          Parameters:
          spec - The requirements for this view
          padding - The padding of this view for the current dimension and margins, if applicable
          childDimension - How big the child wants to be in the current dimension
          Returns:
          a MeasureSpec integer for the child
        • clearDisappearingChildren

          public void clearDisappearingChildren()
          Removes any pending animations for views that have been removed. Call this if you don't want animations for exiting views to stack up.
        • startViewTransition

          public 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. This allows animations, such as those used by Fragment and LayoutTransition to animate the removal of views. A call to this method should always be accompanied by a later call to endViewTransition(View), such as after an animation on the View has finished, so that the View finally gets removed.
          Parameters:
          view - The View object to be kept visible even if it gets removed from its parent.
        • endViewTransition

          public void endViewTransition(View view)
          This method should always be called following an earlier call to startViewTransition(View). The given View is finally removed from its parent and will no longer be displayed. Note that this method does not perform the functionality of removing a view from its parent; it just discontinues the display of a View that has previously been removed.
        • gatherTransparentRegion

          public boolean gatherTransparentRegion(Region region)
          This is used by the RootView to perform an optimization when the view hierarchy contains one or several SurfaceView. SurfaceView is always considered transparent, but its children are not, therefore all View objects remove themselves from the global transparent region (passed as a parameter to this function).
          Overrides:
          gatherTransparentRegion in class View
          Parameters:
          region - The transparent region for this ViewAncestor (window).
          Returns:
          Returns true if the effective visibility of the view at this point is opaque, regardless of the transparent region; returns false if it is possible for underlying windows to be seen behind the view.
        • requestTransparentRegion

          public void requestTransparentRegion(View child)
          Called when a child wants the view hierarchy to gather and report transparent regions to the window compositor. Views that "punch" holes in the view hierarchy, such as SurfaceView can use this API to improve performance of the system. When no such a view is present in the hierarchy, this optimization in unnecessary and might slightly reduce the view hierarchy performance.
          Specified by:
          requestTransparentRegion in interface ViewParent
          Parameters:
          child - the view requesting the transparent region computation
        • fitSystemWindows

          protected boolean fitSystemWindows(Rect insets)
          Description copied from class: View
          Called by the view hierarchy when the content insets for a window have changed, to allow it to adjust its content to fit within those windows. The content insets tell you the space that the status bar, input method, and other system windows infringe on the application's window.

          You do not normally need to deal with this function, since the default window decoration given to applications takes care of applying it to the content of the window. If you use View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION this will not be the case, and your content can be placed under those system elements. You can then use this method within your view hierarchy if you have parts of your UI which you would like to ensure are not being covered.

          The default implementation of this method simply applies the content inset's to the view's padding, consuming that content (modifying the insets to be 0), and returning true. This behavior is off by default, but can be enabled through View.setFitsSystemWindows(boolean).

          This function's traversal down the hierarchy is depth-first. The same content insets object is propagated down the hierarchy, so any changes made to it will be seen by all following views (including potentially ones above in the hierarchy since this is a depth-first traversal). The first view that returns true will abort the entire traversal.

          The default implementation works well for a situation where it is used with a container that covers the entire window, allowing it to apply the appropriate insets to its content on all edges. If you need a more complicated layout (such as two different views fitting system windows, one on the top of the window, and one on the bottom), you can override the method and handle the insets however you would like. Note that the insets provided by the framework are always relative to the far edges of the window, not accounting for the location of the called view within that window. (In fact when this method is called you do not yet know where the layout will place the view, as it is done before layout happens.)

          Note: unlike many View methods, there is no dispatch phase to this call. If you are overriding it in a ViewGroup and want to allow the call to continue to your children, you must be sure to call the super implementation.

          Here is a sample layout that makes use of fitting system windows to have controls for a video view placed inside of the window decorations that it hides and shows. This can be used with code like the second sample (video player) shown in View.setSystemUiVisibility(int).

          Overrides:
          fitSystemWindows in class View
          Parameters:
          insets - Current content insets of the window. Prior to Build.VERSION_CODES.JELLY_BEAN you must not modify the insets or else you and Android will be unhappy.
          Returns:
          Return true if this view applied the insets and it should not continue propagating further down the hierarchy, false otherwise.
          See Also:
          View.getFitsSystemWindows(), View.setFitsSystemWindows(boolean), View.setSystemUiVisibility(int)
        • drawableStateChanged

          protected void drawableStateChanged()
          Description copied from class: View
          This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.

          Be sure to call through to the superclass when overriding this function.

          Overrides:
          drawableStateChanged in class View
          See Also:
          Drawable.setState(int[])
        • onCreateDrawableState

          protected int[] onCreateDrawableState(int extraSpace)
          Description copied from class: View
          Generate the new Drawable state for this view. This is called by the view system when the cached Drawable state is determined to be invalid. To retrieve the current state, you should use View.getDrawableState().
          Overrides:
          onCreateDrawableState in class View
          Parameters:
          extraSpace - if non-zero, this is the number of extra entries you would like in the returned array in which you can place your own states.
          Returns:
          Returns an array holding the current Drawable state of the view.
          See Also:
          View.mergeDrawableStates(int[], int[])
        • setAddStatesFromChildren

          public void setAddStatesFromChildren(boolean addsStates)
          Sets whether this ViewGroup's drawable states also include its children's drawable states. This is used, for example, to make a group appear to be focused when its child EditText or button is focused.
        • addStatesFromChildren

          public boolean addStatesFromChildren()
          Returns whether this ViewGroup's drawable states also include its children's drawable states. This is used, for example, to make a group appear to be focused when its child EditText or button is focused.
        • childDrawableStateChanged

          public void childDrawableStateChanged(View child)
          If addStatesFromChildren() is true, refreshes this group's drawable state (to include the states from its children).
          Specified by:
          childDrawableStateChanged in interface ViewParent
          Parameters:
          child - The child whose drawable state has changed.
        • requestTransitionStart

          public void requestTransitionStart(LayoutTransition transition)
          This method is called by LayoutTransition when there are 'changing' animations that need to start after the layout/setup phase. The request is forwarded to the ViewAncestor, who starts all pending transitions prior to the drawing phase in the current traversal.
          Parameters:
          transition - The LayoutTransition to be started on the next traversal.
        • resolveRtlPropertiesIfNeeded

          public void resolveRtlPropertiesIfNeeded()
          Description copied from class: View
          Resolve all RTL related properties.
          Overrides:
          resolveRtlPropertiesIfNeeded in class View
        • resolveLayoutDirection

          public boolean resolveLayoutDirection()
          Description copied from class: View
          Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing that the parent directionality can and will be resolved before its children.
          Overrides:
          resolveLayoutDirection in class View
          Returns:
          true if resolution has been done, false otherwise.
        • resolveTextDirection

          public boolean resolveTextDirection()
          Description copied from class: View
          Resolve the text direction.
          Overrides:
          resolveTextDirection in class View
          Returns:
          true if resolution has been done, false otherwise.
        • resolveTextAlignment

          public boolean resolveTextAlignment()
          Description copied from class: View
          Resolve the text alignment.
          Overrides:
          resolveTextAlignment in class View
          Returns:
          true if resolution has been done, false otherwise.
        • resolvePadding

          public void resolvePadding()
          Description copied from class: View
          Resolve padding depending on layout direction.
          Overrides:
          resolvePadding in class View
        • resolveDrawables

          protected void resolveDrawables()
          Description copied from class: View
          Resolve the Drawables depending on the layout direction. This is implicitly supposing that the View directionality can and will be resolved before its Drawables. Will call View.onResolveDrawables(int) when resolution is done.
          Overrides:
          resolveDrawables in class View
        • resolveLayoutParams

          public void resolveLayoutParams()
          Description copied from class: View
          Resolve the layout parameters depending on the resolved layout direction
          Overrides:
          resolveLayoutParams in class View
        • resetRtlProperties

          public void resetRtlProperties()
          Description copied from class: View
          Reset resolution of all RTL related properties.
          Overrides:
          resetRtlProperties in class View
        • resetResolvedPadding

          public void resetResolvedPadding()
          Description copied from class: View
          Reset the resolved layout direction.
          Overrides:
          resetResolvedPadding in class View
        • shouldDelayChildPressedState

          public boolean shouldDelayChildPressedState()
          Return true if the pressed state should be delayed for children or descendants of this ViewGroup. Generally, this should be done for containers that can scroll, such as a List. This prevents the pressed state from appearing when the user is actually trying to scroll the content. The default implementation returns true for compatibility reasons. Subclasses that do not scroll should generally override this method and return false.


    Content

    Android Reference

    Java basics

    Java Enterprise Edition (EE)

    Java Standard Edition (SE)

    SQL

    HTML

    PHP

    CSS

    Java Script

    MYSQL

    JQUERY

    VBS

    REGEX

    C

    C++

    C#

    Design patterns

    RFC (standard status)

    RFC (proposed standard status)

    RFC (draft standard status)

    RFC (informational status)

    RFC (experimental status)

    RFC (best current practice status)

    RFC (historic status)

    RFC (unknown status)

    IT dictionary

    License.
    All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
    Copyright 2016 © ELTASK.COM. All rights reserved.
    Site is optimized for mobile devices.
    Downloads: 15206 / 248392429. Delta: 0.09080 с