ViewParent
interface ViewParent
android.view.ViewParent |
Defines the responsibilities for a class that will be a parent of a View. This is the API that a view sees when it wants to interact with its parent.
Summary
Public methods | |
---|---|
abstract Unit |
bringChildToFront(child: View!) Change the z order of the child so it's on top of all other children. |
abstract Boolean |
Tells if this view parent can resolve the layout direction. |
abstract Boolean |
Tells if this view parent can resolve the text alignment. |
abstract Boolean |
Tells if this view parent can resolve the text direction. |
abstract Unit |
childDrawableStateChanged(child: View) This method is called on the parent when a child's drawable state has changed. |
abstract Unit |
childHasTransientStateChanged(child: View, hasTransientState: Boolean) Called when a child view now has or no longer is tracking transient state. |
abstract Unit |
clearChildFocus(child: View!) Called when a child of this parent is giving up focus |
abstract Unit |
Have the parent populate the specified context menu if it has anything to add (and then recurse on its parent). |
open OnBackInvokedDispatcher? |
findOnBackInvokedDispatcherForChild(child: View, requester: View) Walk up the View hierarchy to find the nearest |
abstract View! |
focusSearch(v: View!, direction: Int) Find the nearest view in the specified direction that wants to take focus |
abstract Unit |
Tells the parent that a new focusable view has become available. |
abstract Boolean |
getChildVisibleRect(child: View!, r: Rect!, offset: Point!) Compute the visible part of a rectangular region defined in terms of a child view's coordinates. |
abstract Int |
Return this view parent layout direction. |
abstract ViewParent! |
Returns the parent if it exists, or null. |
abstract ViewParent! |
Gets the parent of a given View for accessibility. |
abstract Int |
Return this view parent text alignment. |
abstract Int |
Return this view parent text direction. |
abstract Unit |
invalidateChild(child: View!, r: Rect!) All or part of a child is dirty and needs to be redrawn. |
abstract ViewParent! |
invalidateChildInParent(location: IntArray!, r: Rect!) All or part of a child is dirty and needs to be redrawn. |
abstract Boolean |
Tells if this view parent layout direction is resolved. |
abstract Boolean |
Indicates whether layout was requested on this view parent. |
abstract Boolean |
Tells if this view parent text alignment is resolved. |
abstract Boolean |
Tells if this view parent text direction is resolved. |
abstract View! |
Find the nearest keyboard navigation cluster in the specified direction. |
abstract Unit |
notifySubtreeAccessibilityStateChanged(child: View, source: View, changeType: Int) Notifies a view parent that the accessibility state of one of its descendants has changed and that the structure of the subtree is different. |
open Unit |
onDescendantInvalidated(child: View, target: View) The target View has been invalidated, or has had a drawing property changed that requires the hierarchy to re-render. |
abstract Boolean |
onNestedFling(target: View, velocityX: Float, velocityY: Float, consumed: Boolean) Request a fling from a nested scroll. |
abstract Boolean |
onNestedPreFling(target: View, velocityX: Float, velocityY: Float) React to a nested fling before the target view consumes it. |
abstract Boolean |
onNestedPrePerformAccessibilityAction(target: View, action: Int, arguments: Bundle?) React to an accessibility action delegated by a target descendant view before the target processes it. |
abstract Unit |
onNestedPreScroll(target: View, dx: Int, dy: Int, consumed: IntArray) React to a nested scroll in progress before the target view consumes a portion of the scroll. |
abstract Unit |
onNestedScroll(target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int) React to a nested scroll in progress. |
abstract Unit |
onNestedScrollAccepted(child: View, target: View, nestedScrollAxes: Int) React to the successful claiming of a nested scroll operation. |
abstract Boolean |
onStartNestedScroll(child: View, target: View, nestedScrollAxes: Int) React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate. |
abstract Unit |
onStopNestedScroll(target: View) React to a nested scroll operation ending. |
abstract Unit |
recomputeViewAttributes(child: View!) Tell view hierarchy that the global view attributes need to be re-evaluated. |
abstract Unit |
requestChildFocus(child: View!, focused: View!) Called when a child of this parent wants focus |
abstract Boolean |
requestChildRectangleOnScreen(child: View, rectangle: Rect!, immediate: Boolean) Called when a child of this group wants a particular rectangle to be positioned onto the screen. |
abstract Unit |
requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) Called when a child does not want this parent and its ancestors to intercept touch events with |
abstract Unit |
Ask that a new dispatch of |
abstract Unit |
Called when something has changed which has invalidated the layout of a child of this view parent. |
abstract Boolean |
requestSendAccessibilityEvent(child: View, event: AccessibilityEvent!) Called by a child to request from its parent to send an |
abstract Unit |
requestTransparentRegion(child: View!) Called when a child wants the view hierarchy to gather and report transparent regions to the window compositor. |
abstract Boolean |
showContextMenuForChild(originalView: View!) Shows the context menu for the specified view or its ancestors. |
abstract Boolean |
showContextMenuForChild(originalView: View!, x: Float, y: Float) Shows the context menu for the specified view or its ancestors anchored to the specified view-relative coordinate. |
abstract ActionMode! |
startActionModeForChild(originalView: View!, callback: ActionMode.Callback!) Start an action mode for the specified view with the default type |
abstract ActionMode! |
startActionModeForChild(originalView: View!, callback: ActionMode.Callback!, type: Int) Start an action mode of a specific type for the specified view. |
Public methods
bringChildToFront
abstract fun bringChildToFront(child: View!): Unit
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 android.os.Build.VERSION_CODES#KITKAT
this method should be followed by calls to requestLayout()
and View#invalidate()
on this parent to force the parent to redraw with the new child ordering.
Parameters | |
---|---|
child |
View!: The child to bring to the top of the z order |
canResolveLayoutDirection
abstract fun canResolveLayoutDirection(): Boolean
Tells if this view parent can resolve the layout direction. See View#setLayoutDirection(int)
Return | |
---|---|
Boolean |
True if this view parent can resolve the layout direction. |
canResolveTextAlignment
abstract fun canResolveTextAlignment(): Boolean
Tells if this view parent can resolve the text alignment. See View#setTextAlignment(int)
Return | |
---|---|
Boolean |
True if this view parent can resolve the text alignment. |
canResolveTextDirection
abstract fun canResolveTextDirection(): Boolean
Tells if this view parent can resolve the text direction. See View#setTextDirection(int)
Return | |
---|---|
Boolean |
True if this view parent can resolve the text direction. |
childDrawableStateChanged
abstract fun childDrawableStateChanged(child: View): Unit
This method is called on the parent when a child's drawable state has changed.
Parameters | |
---|---|
child |
View: The child whose drawable state has changed. This value cannot be null . |
childHasTransientStateChanged
abstract fun childHasTransientStateChanged(
child: View,
hasTransientState: Boolean
): Unit
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.
Parameters | |
---|---|
child |
View: Child view whose state has changed This value cannot be null . |
hasTransientState |
Boolean: true if this child has transient state |
clearChildFocus
abstract fun clearChildFocus(child: View!): Unit
Called when a child of this parent is giving up focus
Parameters | |
---|---|
child |
View!: The view that is giving up focus |
createContextMenu
abstract fun createContextMenu(: ContextMenu!): Unit
Have the parent populate the specified context menu if it has anything to add (and then recurse on its parent).
Parameters | |
---|---|
menu |
ContextMenu!: The menu to populate |
findOnBackInvokedDispatcherForChild
open fun findOnBackInvokedDispatcherForChild(
child: View,
requester: View
): OnBackInvokedDispatcher?
Walk up the View hierarchy to find the nearest OnBackInvokedDispatcher
.
Parameters | |
---|---|
child |
View: The direct child of this view for which to find a dispatcher. This value cannot be null . |
requester |
View: The requester that will use the dispatcher. Can be the same as child. This value cannot be null . |
Return | |
---|---|
OnBackInvokedDispatcher? |
The OnBackInvokedDispatcher from this or the nearest ancestor, or null if the view is both not attached and have no ancestor providing an OnBackInvokedDispatcher . |
focusSearch
abstract fun focusSearch(
v: View!,
direction: Int
): View!
Find the nearest view in the specified direction that wants to take focus
Parameters | |
---|---|
v |
View!: The view that currently has focus |
direction |
Int: One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT |
focusableViewAvailable
abstract fun focusableViewAvailable(v: View!): Unit
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.
Parameters | |
---|---|
v |
View!: The view that has become newly focusable |
getChildVisibleRect
abstract fun getChildVisibleRect(
child: View!,
r: Rect!,
offset: Point!
): Boolean
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.
Parameters | |
---|---|
child |
View!: A child View, whose rectangular visible region we want to compute |
r |
Rect!: The input rectangle, defined in the child coordinate system. Will be overwritten to contain the resulting visible rectangle, expressed in global (root) coordinates |
offset |
Point!: 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) |
Return | |
---|---|
Boolean |
true if the resulting rectangle is not empty, false otherwise |
getLayoutDirection
abstract fun getLayoutDirection(): Int
Return this view parent layout direction. See View#getLayoutDirection()
Return | |
---|---|
Int |
View#LAYOUT_DIRECTION_RTL if the layout direction is RTL or returns View#LAYOUT_DIRECTION_LTR if the layout direction is not RTL. |
getParent
abstract fun getParent(): ViewParent!
Returns the parent if it exists, or null.
Return | |
---|---|
ViewParent! |
a ViewParent or null if this ViewParent does not have a parent |
getParentForAccessibility
abstract fun getParentForAccessibility(): ViewParent!
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.
Return | |
---|---|
ViewParent! |
The parent or null if no such is found. |
getTextAlignment
abstract fun getTextAlignment(): Int
Return this view parent text alignment. See android.view.View#getTextAlignment()
Return | |
---|---|
Int |
the resolved text alignment. Returns one of: View#TEXT_ALIGNMENT_GRAVITY , View#TEXT_ALIGNMENT_CENTER , View#TEXT_ALIGNMENT_TEXT_START , View#TEXT_ALIGNMENT_TEXT_END , View#TEXT_ALIGNMENT_VIEW_START , View#TEXT_ALIGNMENT_VIEW_END |
getTextDirection
abstract fun getTextDirection(): Int
Return this view parent text direction. See View#getTextDirection()
Return | |
---|---|
Int |
the resolved text direction. Returns one of: View#TEXT_DIRECTION_FIRST_STRONG View#TEXT_DIRECTION_ANY_RTL , View#TEXT_DIRECTION_LTR , View#TEXT_DIRECTION_RTL , View#TEXT_DIRECTION_LOCALE |
invalidateChild
abstract funinvalidateChild(
child: View!,
r: Rect!
): Unit
Deprecated: Use onDescendantInvalidated(android.view.View,android.view.View)
instead.
All or part of a child is dirty and needs to be redrawn.
Parameters | |
---|---|
child |
View!: The child which is dirty |
r |
Rect!: The area within the child that is invalid |
invalidateChildInParent
abstract funinvalidateChildInParent(
location: IntArray!,
r: Rect!
): ViewParent!
Deprecated: Use onDescendantInvalidated(android.view.View,android.view.View)
instead.
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.
Parameters | |
---|---|
location |
IntArray!: An array of 2 ints containing the left and top coordinates of the child to invalidate |
r |
Rect!: The area within the child that is invalid |
Return | |
---|---|
ViewParent! |
the parent of this ViewParent or null |
isLayoutDirectionResolved
abstract fun isLayoutDirectionResolved(): Boolean
Tells if this view parent layout direction is resolved. See View#setLayoutDirection(int)
Return | |
---|---|
Boolean |
True if this view parent layout direction is resolved. |
isLayoutRequested
abstract fun isLayoutRequested(): Boolean
Indicates whether layout was requested on this view parent.
Return | |
---|---|
Boolean |
true if layout was requested, false otherwise |
isTextAlignmentResolved
abstract fun isTextAlignmentResolved(): Boolean
Tells if this view parent text alignment is resolved. See View#setTextAlignment(int)
Return | |
---|---|
Boolean |
True if this view parent text alignment is resolved. |
isTextDirectionResolved
abstract fun isTextDirectionResolved(): Boolean
Tells if this view parent text direction is resolved. See View#setTextDirection(int)
Return | |
---|---|
Boolean |
True if this view parent text direction is resolved. |
keyboardNavigationClusterSearch
abstract fun keyboardNavigationClusterSearch(
: View!,
: Int
): View!
Find the nearest keyboard navigation cluster in the specified direction. This does not actually give focus to that cluster.
Parameters | |
---|---|
currentCluster |
View!: The starting point of the search. Null means the current cluster is not found yet |
direction |
Int: Direction to look |
Return | |
---|---|
View! |
The nearest keyboard navigation cluster in the specified direction, or null if none can be found |
notifySubtreeAccessibilityStateChanged
abstract fun notifySubtreeAccessibilityStateChanged(
child: View,
source: View,
changeType: Int
): Unit
Notifies a view parent that the accessibility state of one of its descendants has changed and that the structure of the subtree is different.
Parameters | |
---|---|
child |
View: The direct child whose subtree has changed. This value cannot be null . |
source |
View: The descendant view that changed. May not be null . |
changeType |
Int: A bit mask of the types of changes that occurred. One or more of:
|
onDescendantInvalidated
open fun onDescendantInvalidated(
child: View,
target: View
): Unit
The target View has been invalidated, or has had a drawing property changed that requires the hierarchy to re-render. This method is called by the View hierarchy to signal ancestors that a View either needs to re-record its drawing commands, or drawing properties have changed. This is how Views schedule a drawing traversal. This signal is generally only dispatched for attached Views, since only they need to draw.
Parameters | |
---|---|
child |
View: Direct child of this ViewParent containing target This value cannot be null . |
target |
View: The view that needs to redraw This value cannot be null . |
onNestedFling
abstract fun onNestedFling(
target: View,
velocityX: Float,
velocityY: Float,
consumed: Boolean
): Boolean
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 velocity
in the direction of scrolling that meets or exceeds the 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.
Parameters | |
---|---|
target |
View: View that initiated the nested scroll This value cannot be null . |
velocityX |
Float: Horizontal velocity in pixels per second |
velocityY |
Float: Vertical velocity in pixels per second |
consumed |
Boolean: true if the child consumed the fling, false otherwise |
Return | |
---|---|
Boolean |
true if this parent consumed or otherwise reacted to the fling |
onNestedPreFling
abstract fun onNestedPreFling(
target: View,
velocityX: Float,
velocityY: Float
): Boolean
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 velocity
in the direction of scrolling that meets or exceeds the minimum fling velocity
along a scrollable axis.
If a nested scrolling parent is consuming motion as part of a 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.
Parameters | |
---|---|
target |
View: View that initiated the nested scroll This value cannot be null . |
velocityX |
Float: Horizontal velocity in pixels per second |
velocityY |
Float: Vertical velocity in pixels per second |
Return | |
---|---|
Boolean |
true if this parent consumed the fling ahead of the target view |
onNestedPrePerformAccessibilityAction
abstract fun onNestedPrePerformAccessibilityAction(
target: View,
action: Int,
arguments: Bundle?
): Boolean
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 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.
Parameters | |
---|---|
target |
View: The target view dispatching this action This value cannot be null . |
action |
Int: Action being performed; see android.view.accessibility.AccessibilityNodeInfo |
arguments |
Bundle?: Optional action arguments This value may be null . |
Return | |
---|---|
Boolean |
true if the action was consumed by this ViewParent |
onNestedPreScroll
abstract fun onNestedPreScroll(
target: View,
dx: Int,
dy: Int,
consumed: IntArray
): Unit
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 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.
Parameters | |
---|---|
target |
View: View that initiated the nested scroll This value cannot be null . |
dx |
Int: Horizontal scroll distance in pixels |
dy |
Int: Vertical scroll distance in pixels |
consumed |
IntArray: Output. The horizontal and vertical scroll distance consumed by this parent This value cannot be null . |
onNestedScroll
abstract fun onNestedScroll(
target: View,
dxConsumed: Int,
dyConsumed: Int,
dxUnconsumed: Int,
dyUnconsumed: Int
): Unit
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 onStartNestedScroll(android.view.View,android.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.
Parameters | |
---|---|
target |
View: The descendent view controlling the nested scroll This value cannot be null . |
dxConsumed |
Int: Horizontal scroll distance in pixels already consumed by target |
dyConsumed |
Int: Vertical scroll distance in pixels already consumed by target |
dxUnconsumed |
Int: Horizontal scroll distance in pixels not consumed by target |
dyUnconsumed |
Int: Vertical scroll distance in pixels not consumed by target |
onNestedScrollAccepted
abstract fun onNestedScrollAccepted(
child: View,
target: View,
nestedScrollAxes: Int
): Unit
React to the successful claiming of a nested scroll operation.
This method will be called after 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.
Parameters | |
---|---|
child |
View: Direct child of this ViewParent containing target This value cannot be null . |
target |
View: View that initiated the nested scroll This value cannot be null . |
nestedScrollAxes |
Int: Flags consisting of View#SCROLL_AXIS_HORIZONTAL , View#SCROLL_AXIS_VERTICAL or both |
onStartNestedScroll
abstract fun onStartNestedScroll(
child: View,
target: View,
nestedScrollAxes: Int
): Boolean
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 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 onStopNestedScroll(android.view.View)
.
Parameters | |
---|---|
child |
View: Direct child of this ViewParent containing target This value cannot be null . |
target |
View: View that initiated the nested scroll This value cannot be null . |
nestedScrollAxes |
Int: Flags consisting of View#SCROLL_AXIS_HORIZONTAL , View#SCROLL_AXIS_VERTICAL or both |
Return | |
---|---|
Boolean |
true if this ViewParent accepts the nested scroll operation |
onStopNestedScroll
abstract fun onStopNestedScroll(target: View): Unit
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 MotionEvent#ACTION_UP
or MotionEvent#ACTION_CANCEL
event. Implementations of this method should always call their superclass's implementation of this method if one is present.
Parameters | |
---|---|
target |
View: View that initiated the nested scroll This value cannot be null . |
recomputeViewAttributes
abstract fun recomputeViewAttributes(child: View!): Unit
Tell view hierarchy that the global view attributes need to be re-evaluated.
Parameters | |
---|---|
child |
View!: View whose attributes have changed. |
requestChildFocus
abstract fun requestChildFocus(
child: View!,
focused: View!
): Unit
Called when a child of this parent wants focus
Parameters | |
---|---|
child |
View!: 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 |
View!: The view that is a descendant of child that actually has focus |
requestChildRectangleOnScreen
abstract fun requestChildRectangleOnScreen(
child: View,
rectangle: Rect!,
immediate: Boolean
): Boolean
Called when a child of this group wants a particular rectangle to be positioned onto the screen. ViewGroup
s overriding this can trust that:
- child will be a direct child of this group
- rectangle will be in the child's content coordinates
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
Parameters | |
---|---|
child |
View: The direct child making the request. This value cannot be null . |
rectangle |
Rect!: The rectangle in the child's coordinates the child wishes to be on the screen. |
immediate |
Boolean: True to forbid animated or delayed scrolling, false otherwise |
Return | |
---|---|
Boolean |
Whether the group scrolled to handle the operation |
requestDisallowInterceptTouchEvent
abstract fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean): Unit
Called when a child does not want this parent and its ancestors to intercept touch events with 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.
Parameters | |
---|---|
disallowIntercept |
Boolean: True if the child does not want the parent to intercept touch events. |
requestFitSystemWindows
abstract fun requestFitSystemWindows(): Unit
Ask that a new dispatch of View.fitSystemWindows(Rect)
be performed.
requestLayout
abstract fun requestLayout(): Unit
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.
requestSendAccessibilityEvent
abstract fun requestSendAccessibilityEvent(
child: View,
event: AccessibilityEvent!
): Boolean
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.
Parameters | |
---|---|
child |
View: The child which requests sending the event. This value cannot be null . |
event |
AccessibilityEvent!: The event to be sent. |
Return | |
---|---|
Boolean |
True if the event was sent. |
requestTransparentRegion
abstract fun requestTransparentRegion(child: View!): Unit
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.
Parameters | |
---|---|
child |
View!: the view requesting the transparent region computation |
showContextMenuForChild
abstract fun showContextMenuForChild(originalView: View!): Boolean
Shows the 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.
Parameters | |
---|---|
originalView |
View!: the source view where the context menu was first invoked |
Return | |
---|---|
Boolean |
true if the context menu was shown, false otherwise |
showContextMenuForChild
abstract fun showContextMenuForChild(
originalView: View!,
x: Float,
y: Float
): Boolean
Shows the context menu for the specified view or its ancestors anchored to the specified view-relative coordinate.
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.
If a subclass overrides this method it should also override showContextMenuForChild(android.view.View)
.
Parameters | |
---|---|
originalView |
View!: the source view where the context menu was first invoked |
x |
Float: the X coordinate in pixels relative to the original view to which the menu should be anchored, or Float#NaN to disable anchoring |
y |
Float: the Y coordinate in pixels relative to the original view to which the menu should be anchored, or Float#NaN to disable anchoring |
Return | |
---|---|
Boolean |
true if the context menu was shown, false otherwise |
startActionModeForChild
abstract fun startActionModeForChild(
originalView: View!,
callback: ActionMode.Callback!
): ActionMode!
Start an action mode for the specified view with the default type ActionMode#TYPE_PRIMARY
.
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.
Parameters | |
---|---|
originalView |
View!: The source view where the action mode was first invoked |
callback |
ActionMode.Callback!: The callback that will handle lifecycle events for the action mode |
Return | |
---|---|
ActionMode! |
The new action mode if it was started, null otherwise |
startActionModeForChild
abstract fun startActionModeForChild(
originalView: View!,
callback: ActionMode.Callback!,
type: Int
): ActionMode!
Start an action mode of a specific type 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.
Parameters | |
---|---|
originalView |
View!: The source view where the action mode was first invoked |
callback |
ActionMode.Callback!: The callback that will handle lifecycle events for the action mode |
type |
Int: One of ActionMode#TYPE_PRIMARY or ActionMode#TYPE_FLOATING . |
Return | |
---|---|
ActionMode! |
The new action mode if it was started, null otherwise |