public interface ViewParent
Modifier and Type | Method and Description |
---|---|
void |
bringChildToFront(View child)
Change the z order of the child so it's on top of all other children
|
void |
childAccessibilityStateChanged(View child)
A child notifies its parent that its state for accessibility has changed.
|
void |
childDrawableStateChanged(View child)
This method is called on the parent when a child's drawable state
has changed.
|
void |
childHasTransientStateChanged(View child,
boolean hasTransientState)
Called when a child view now has or no longer is tracking transient state.
|
void |
clearChildFocus(View child)
Called when a child of this parent is giving up focus
|
void |
createContextMenu(ContextMenu menu)
Have the parent populate the specified context menu if it has anything to
add (and then recurse on its parent).
|
void |
focusableViewAvailable(View v)
Tells the parent that a new focusable view has become available.
|
View |
focusSearch(View v,
int direction)
Find the nearest view in the specified direction that wants to take focus
|
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.
|
ViewParent |
getParent()
Returns the parent if it exists, or null.
|
ViewParent |
getParentForAccessibility()
Gets the parent of a given View for accessibility.
|
void |
invalidateChild(View child,
Rect r)
All or part of a child is dirty and needs to be redrawn.
|
ViewParent |
invalidateChildInParent(int[] location,
Rect r)
All or part of a child is dirty and needs to be redrawn.
|
boolean |
isLayoutRequested()
Indicates whether layout was requested on this view parent.
|
void |
recomputeViewAttributes(View child)
Tell view hierarchy that the global view attributes need to be
re-evaluated.
|
void |
requestChildFocus(View child,
View focused)
Called when a child of this parent wants focus
|
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.
|
void |
requestDisallowInterceptTouchEvent(boolean disallowIntercept)
Called when a child does not want this parent and its ancestors to
intercept touch events with
ViewGroup.onInterceptTouchEvent(MotionEvent) . |
void |
requestFitSystemWindows()
Ask that a new dispatch of
View.fitSystemWindows(Rect) be performed. |
void |
requestLayout()
Called when something has changed which has invalidated the layout of a
child of this view parent.
|
boolean |
requestSendAccessibilityEvent(View child,
AccessibilityEvent event)
Called by a child to request from its parent to send an
AccessibilityEvent . |
void |
requestTransparentRegion(View child)
Called when a child wants the view hierarchy to gather and report
transparent regions to the window compositor.
|
boolean |
showContextMenuForChild(View originalView)
Bring up a context menu for the specified view or its ancestors.
|
ActionMode |
startActionModeForChild(View originalView,
ActionMode.Callback callback)
Start an action mode for the specified view.
|
void requestLayout()
boolean isLayoutRequested()
void requestTransparentRegion(View child)
child
- the view requesting the transparent region computationvoid invalidateChild(View child, Rect r)
child
- The child which is dirtyr
- The area within the child that is invalidViewParent invalidateChildInParent(int[] location, Rect r)
The location array is an array of two int values which respectively define the left and the top position of the dirty child.
This method must return the parent of this ViewParent if the specified rectangle must be invalidated in the parent. If the specified rectangle does not require invalidation in the parent or if the parent does not exist, this method must return null.
When this method returns a non-null value, the location array must have been updated with the left and top coordinates of this ViewParent.
location
- An array of 2 ints containing the left and top
coordinates of the child to invalidater
- The area within the child that is invalidViewParent getParent()
void requestChildFocus(View child, View focused)
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
focusvoid recomputeViewAttributes(View child)
child
- View whose attributes have changed.void clearChildFocus(View child)
child
- The view that is giving up focusboolean getChildVisibleRect(View child, Rect r, Point offset)
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.
child
- A child View, whose rectangular visible region we want to computer
- The input rectangle, defined in the child coordinate system. Will be overwritten to
contain the resulting visible rectangle, expressed in global (root) coordinatesoffset
- 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)View focusSearch(View v, int direction)
v
- The view that currently has focusdirection
- One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHTvoid bringChildToFront(View child)
child
- void focusableViewAvailable(View v)
v
- The view that has become newly focusableboolean showContextMenuForChild(View originalView)
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.
originalView
- The source view where the context menu was first invokedvoid createContextMenu(ContextMenu menu)
menu
- The menu to populateActionMode startActionModeForChild(View originalView, ActionMode.Callback callback)
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.
originalView
- The source view where the action mode was first invokedcallback
- The callback that will handle lifecycle events for the action modevoid childDrawableStateChanged(View child)
child
- The child whose drawable state has changed.void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
ViewGroup.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.
disallowIntercept
- True if the child does not want the parent to
intercept touch events.boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate)
ViewGroup
s overriding this can trust
that:
ViewGroup
s overriding this should uphold the contract:
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 otherwiseboolean requestSendAccessibilityEvent(View child, AccessibilityEvent event)
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.
child
- The child which requests sending the event.event
- The event to be sent.void childHasTransientStateChanged(View child, boolean hasTransientState)
child
- Child view whose state has changedhasTransientState
- true if this child has transient statevoid requestFitSystemWindows()
View.fitSystemWindows(Rect)
be performed.ViewParent getParentForAccessibility()
null
if no such is found.void childAccessibilityStateChanged(View child)