Methods Summary |
---|
public void | bringChildToFront(View child)Change the z order of the child so it's on top of all other children.
This ordering change may affect layout, if this container
uses an order-dependent layout scheme (e.g., LinearLayout). Prior
to {@link android.os.Build.VERSION_CODES#KITKAT} this
method should be followed by calls to {@link #requestLayout()} and
{@link View#invalidate()} on this parent to force the parent to redraw
with the new child ordering.
|
public boolean | canResolveLayoutDirection()Tells if this view parent can resolve the layout direction.
See {@link View#setLayoutDirection(int)}
|
public boolean | canResolveTextAlignment()Tells if this view parent can resolve the text alignment.
See {@link View#setTextAlignment(int)}
|
public boolean | canResolveTextDirection()Tells if this view parent can resolve the text direction.
See {@link View#setTextDirection(int)}
|
public void | childDrawableStateChanged(View child)This method is called on the parent when a child's drawable state
has changed.
|
public void | childHasTransientStateChanged(View child, boolean hasTransientState)Called when a child view now has or no longer is tracking transient state.
"Transient state" is any state that a View might hold that is not expected to
be reflected in the data model that the View currently presents. This state only
affects the presentation to the user within the View itself, such as the current
state of animations in progress or the state of a text selection operation.
Transient state is useful for hinting to other components of the View system
that a particular view is tracking something complex but encapsulated.
A ListView for example may acknowledge that list item Views
with transient state should be preserved within their position or stable item ID
instead of treating that view as trivially replaceable by the backing adapter.
This allows adapter implementations to be simpler instead of needing to track
the state of item view animations in progress such that they could be restored
in the event of an unexpected recycling and rebinding of attached item views.
This method is called on a parent view when a child view or a view within
its subtree begins or ends tracking of internal transient state.
|
public void | clearChildFocus(View child)Called when a child of this parent is giving up focus
|
public void | createContextMenu(ContextMenu menu)Have the parent populate the specified context menu if it has anything to
add (and then recurse on its parent).
|
public View | focusSearch(View v, int direction)Find the nearest view in the specified direction that wants to take focus
|
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.
|
public boolean | getChildVisibleRect(View child, android.graphics.Rect r, android.graphics.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.
|
public int | getLayoutDirection()Return this view parent layout direction. See {@link View#getLayoutDirection()}
|
public android.view.ViewParent | getParent()Returns the parent if it exists, or null.
|
public android.view.ViewParent | getParentForAccessibility()Gets the parent of a given View for accessibility. Since some Views are not
exposed to the accessibility layer the parent for accessibility is not
necessarily the direct parent of the View, rather it is a predecessor.
|
public int | getTextAlignment()Return this view parent text alignment. See {@link android.view.View#getTextAlignment()}
|
public int | getTextDirection()Return this view parent text direction. See {@link View#getTextDirection()}
|
public void | invalidateChild(View child, android.graphics.Rect r)All or part of a child is dirty and needs to be redrawn.
|
public android.view.ViewParent | invalidateChildInParent(int[] location, android.graphics.Rect r)All or part of a child is dirty and needs to be redrawn.
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.
|
public boolean | isLayoutDirectionResolved()Tells if this view parent layout direction is resolved.
See {@link View#setLayoutDirection(int)}
|
public boolean | isLayoutRequested()Indicates whether layout was requested on this view parent.
|
public boolean | isTextAlignmentResolved()Tells if this view parent text alignment is resolved.
See {@link View#setTextAlignment(int)}
|
public boolean | isTextDirectionResolved()Tells if this view parent text direction is resolved.
See {@link View#setTextDirection(int)}
|
public void | notifySubtreeAccessibilityStateChanged(View child, View source, int changeType)Notifies a view parent that the accessibility state of one of its
descendants has changed and that the structure of the subtree is
different.
|
public boolean | onNestedFling(View target, float velocityX, float velocityY, boolean consumed)Request a fling from a nested scroll.
This method signifies that a nested scrolling child has detected suitable conditions
for a fling. Generally this means that a touch scroll has ended with a
{@link VelocityTracker velocity} in the direction of scrolling that meets or exceeds
the {@link ViewConfiguration#getScaledMinimumFlingVelocity() minimum fling velocity}
along a scrollable axis.
If a nested scrolling child view would normally fling but it is at the edge of
its own content, it can use this method to delegate the fling to its nested scrolling
parent instead. The parent may optionally consume the fling or observe a child fling.
|
public boolean | onNestedPreFling(View target, float velocityX, float velocityY)React to a nested fling before the target view consumes it.
This method siginfies that a nested scrolling child has detected a fling with the given
velocity along each axis. Generally this means that a touch scroll has ended with a
{@link VelocityTracker velocity} in the direction of scrolling that meets or exceeds
the {@link ViewConfiguration#getScaledMinimumFlingVelocity() minimum fling velocity}
along a scrollable axis.
If a nested scrolling parent is consuming motion as part of a
{@link #onNestedPreScroll(View, int, int, int[]) pre-scroll}, it may be appropriate for
it to also consume the pre-fling to complete that same motion. By returning
true from this method, the parent indicates that the child should not
fling its own internal content as well.
|
public boolean | onNestedPrePerformAccessibilityAction(View target, int action, android.os.Bundle arguments)React to an accessibility action delegated by a target descendant view before the target
processes it.
This method may be called by a target descendant view if the target wishes to give
a view in its parent chain a chance to react to the event before normal processing occurs.
Most commonly this will be a scroll event such as
{@link android.view.accessibility.AccessibilityNodeInfo#ACTION_SCROLL_FORWARD}.
A ViewParent that supports acting as a nested scrolling parent should override this
method and act accordingly to implement scrolling via accesibility systems.
|
public void | onNestedPreScroll(View target, int dx, int dy, int[] consumed)React to a nested scroll in progress before the target view consumes a portion of the scroll.
When working with nested scrolling often the parent view may want an opportunity
to consume the scroll before the nested scrolling child does. An example of this is a
drawer that contains a scrollable list. The user will want to be able to scroll the list
fully into view before the list itself begins scrolling.
onNestedPreScroll is called when a nested scrolling child invokes
{@link View#dispatchNestedPreScroll(int, int, int[], int[])}. The implementation should
report how any pixels of the scroll reported by dx, dy were consumed in the
consumed array. Index 0 corresponds to dx and index 1 corresponds to dy.
This parameter will never be null. Initial values for consumed[0] and consumed[1]
will always be 0.
|
public void | onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)React to a nested scroll in progress.
This method will be called when the ViewParent's current nested scrolling child view
dispatches a nested scroll event. To receive calls to this method the ViewParent must have
previously returned true for a call to
{@link #onStartNestedScroll(View, View, int)}.
Both the consumed and unconsumed portions of the scroll distance are reported to the
ViewParent. An implementation may choose to use the consumed portion to match or chase scroll
position of multiple child elements, for example. The unconsumed portion may be used to
allow continuous dragging of multiple scrolling or draggable elements, such as scrolling
a list within a vertical drawer where the drawer begins dragging once the edge of inner
scrolling content is reached.
|
public void | onNestedScrollAccepted(View child, View target, int nestedScrollAxes)React to the successful claiming of a nested scroll operation.
This method will be called after
{@link #onStartNestedScroll(View, View, int) onStartNestedScroll} returns true. It offers
an opportunity for the view and its superclasses to perform initial configuration
for the nested scroll. Implementations of this method should always call their superclass's
implementation of this method if one is present.
|
public boolean | onStartNestedScroll(View child, View target, int nestedScrollAxes)React to a descendant view initiating a nestable scroll operation, claiming the
nested scroll operation if appropriate.
This method will be called in response to a descendant view invoking
{@link View#startNestedScroll(int)}. Each parent up the view hierarchy will be
given an opportunity to respond and claim the nested scrolling operation by returning
true .
This method may be overridden by ViewParent implementations to indicate when the view
is willing to support a nested scrolling operation that is about to begin. If it returns
true, this ViewParent will become the target view's nested scrolling parent for the duration
of the scroll operation in progress. When the nested scroll is finished this ViewParent
will receive a call to {@link #onStopNestedScroll(View)}.
|
public void | onStopNestedScroll(View target)React to a nested scroll operation ending.
Perform cleanup after a nested scrolling operation.
This method will be called when a nested scroll stops, for example when a nested touch
scroll ends with a {@link MotionEvent#ACTION_UP} or {@link MotionEvent#ACTION_CANCEL} event.
Implementations of this method should always call their superclass's implementation of this
method if one is present.
|
public void | recomputeViewAttributes(View child)Tell view hierarchy that the global view attributes need to be
re-evaluated.
|
public void | requestChildFocus(View child, View focused)Called when a child of this parent wants focus
|
public boolean | requestChildRectangleOnScreen(View child, android.graphics.Rect rectangle, boolean immediate)Called when a child of this group wants a particular rectangle to be
positioned onto the screen. {@link ViewGroup}s overriding this can trust
that:
- child will be a direct child of this group
- rectangle will be in the child's coordinates
{@link ViewGroup}s 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
|
public void | requestDisallowInterceptTouchEvent(boolean disallowIntercept)Called when a child does not want this parent and its ancestors to
intercept touch events with
{@link 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.
|
public void | requestFitSystemWindows()Ask that a new dispatch of {@link View#fitSystemWindows(Rect)
View.fitSystemWindows(Rect)} be performed.
|
public void | requestLayout()Called when something has changed which has invalidated the layout of a
child of this view parent. This will schedule a layout pass of the view
tree.
|
public boolean | requestSendAccessibilityEvent(View child, android.view.accessibility.AccessibilityEvent event)Called by a child to request from its parent to send an {@link 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.
|
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.
|
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,
{@link ViewManager#addView(View, android.view.ViewGroup.LayoutParams)})
then it should override this and show the context menu.
|
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,
{@link ViewManager#addView(View, android.view.ViewGroup.LayoutParams)})
then it should override this and start the action mode.
|