ViewParent定义一个类的职责,该类将是视图的父级。当一个view要与其父容器交互时,会使用到这些API。
公有方法 | |
---|---|
abstract void | bringChlidToFront(view child) 改变子视图在Z轴上的顺序,使其能在其他子视图的最上面。 Change the z order of the child so it's on top of all other children |
abstract void | childDrawableStateChanged(View child) 当子视图的drawable状态发生改变时,该方法会在父容器中被调用。 This method is called on the parent when a child's drawable state has changed. |
abstract void | clearChildFocus(View child) 当这个父容器中的一个子视图放弃焦点时该方法会被调用。 Called when a child of this parent is giving up focus |
abstract void | createContextMenu( ContextMenu menu) 创建上下文菜单 Have the parent populate the specified context menu if it has anything to add (and then recurse on its parent). |
abstract View | focusSearch(View v, int direction) 查找指定方向的最近视图以获取焦点. Find the nearest view in the specified direction that wants to take focus |
abstract void | focusableViewAvailable(View v) 告诉父容器,有一个新的可获得焦点的视图可用。 Tells the parent that a new focusable view has become available. |
abstract 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. |
abstract ViewParent | getParent() 如果父容器存在则返回父容器对象,否则返回null。 Returns the parent if it exists, or null. |
abstract ViewParent | getParentForAccessibility() 获取可访问的给定视图的父级。 Gets the parent of a given View for accessibility. |
abstract void | invalidateChild(View child, Rect r) 全部或部分子视图改变了,需要重新绘制。 All or part of a child is dirty and needs to be redrawn. |
abstract ViewParent | invalidateChildInParent(int[] location, Rect r) 全部或部分子视图改变了,需要重新绘制。 All or part of a child is dirty and needs to be redrawn. |
abstract boolean | isLayoutRequested() 指示父视图上是否要求布局。 Indicates whether layout was requested on this view parent. |
abstract void | recomputeViewAttributes(View child) 告诉视图层次结构,需要重新评估全局视图属性。 Tell view hierarchy that the global view attributes need to be re-evaluated. |
abstract void | requestChildFocus(View child, View focused) 当子视图请求获取焦点时调用。 Called when a child of this parent wants focus |
abstract 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. |
abstract void | requestDisallowInterceptTouchEvent(boolean disallowIntercept) 当子视图不需要其父或祖先类使用onInterceptTouchEvent(MotionEvent)拦截触摸事件时调用。 Called when a child does not want this parent and its ancestors to intercept touch events with onInterceptTouchEvent(MotionEvent). |
abstract void | requestFitSystemWindows() 要求一个新的View.fitSystemWindows(Rect)调度被执行。 Ask that a new dispatch of View.fitSystemWindows(Rect) be performed. |
abstract void | requestLayout() 当发生了一些改变,使得视图的布局变得无效时点用。 Called when something has changed which has invalidated the layout of a child of this view parent. |
abstract boolean | requestSendAccessibilityEvent(View child, AccessibilityEvent event) 子视图请求父容器发送一个AccessibilityEvent事件。 Called by a child to request from its parent to send an AccessibilityEvent. |
abstract void | requestTransparentRegion(View child) 当一个子视图需要视图层次收集和报告窗口透明区域排序时调用。 Called when a child wants the view hierarchy to gather and report transparent regions to the window compositor. |
abstract boolean | showContextMenuForChild(View originalView) 为指定视图或其祖先提供上下文菜单。 Bring up a context menu for the specified view or its ancestors. |
abstract ActionMode | startActionModeForChild(View originalView, ActionMode.Callback callback) 为指定视图启动操作模式。 Start an action mode for the specified view. |
网友评论