Class WindowGroup

All Implemented Interfaces:
Drawable.Callback, ViewManager, ViewParent, WindowManager

@Internal public final class WindowGroup extends ViewGroup implements WindowManager
The root view of window view hierarchy, allowing for sub windows (panels), such as menu popups, tooltips and toasts.
  • Constructor Details

  • Method Details

    • dispatchTouchEvent

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

      protected boolean dispatchHoverEvent(@NonNull MotionEvent event)
      Description copied from class: View
      Dispatch a hover event.

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

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

      protected boolean dispatchGenericPointerEvent(@NonNull MotionEvent event)
      Description copied from class: View
      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 ViewGroup
      Parameters:
      event - The motion event to be dispatched.
      Returns:
      True if the event was handled by the view, false otherwise.
    • onResolvePointerIcon

      public PointerIcon onResolvePointerIcon(@NonNull MotionEvent event)
      Description copied from class: View
      Returns the pointer icon for the motion event, or null if it doesn't specify the icon. The default implementation does not care the location or event types, but some subclasses may use it (such as WebViews).
      Overrides:
      onResolvePointerIcon in class ViewGroup
      Parameters:
      event - The MotionEvent from a mouse
      See Also:
    • addView

      public void addView(@NonNull View child, int index, @NonNull ViewGroup.LayoutParams params)
      Description copied from class: ViewGroup
      Adds a child view with the specified layout parameters.

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

      Overrides:
      addView in class ViewGroup
      Parameters:
      child - the child view to add
      index - the position at which to add the child or -1 to add last
      params - the layout parameters to set on the child
    • onViewAdded

      protected void onViewAdded(View child)
      Description copied from class: ViewGroup
      Called when a new child is added to this ViewGroup. Overrides should always call super.onViewAdded.
      Overrides:
      onViewAdded in class ViewGroup
      Parameters:
      child - the added child view
    • onRequestFocusInDescendants

      protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect)
      Description copied from class: ViewGroup
      Look for a descendant to call View.requestFocus() on. Called by ViewGroup.requestFocus(int, Rect) when it wants to request focus within its children. Override this to customize how your ViewGroup requests focus within its children.
      Overrides:
      onRequestFocusInDescendants in class ViewGroup
      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.
    • onMeasure

      protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
      Description copied from class: View
      Measure the view and its content to determine the measured width and the measured height. This method is invoked by View.measure(int, int) and should be overridden by subclasses to provide accurate and efficient measurement of their contents.

      CONTRACT: When overriding this method, you must call View.setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by View.measure(int, int). Calling super.onMeasure() is a valid use.

      The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override the base one to provide better measurements of their content.

      Overrides:
      onMeasure in class View
      Parameters:
      widthMeasureSpec - width measure specification imposed by the parent MeasureSpec
      heightMeasureSpec - height measure specification imposed by the parent MeasureSpec
    • onLayout

      protected void onLayout(boolean changed, int left, int top, int right, int bottom)
      Description copied from class: View
      Called from View.layout(int, int, int, int) 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.

      Specified by:
      onLayout in class ViewGroup
      Parameters:
      changed - This is a new size or position for this view
      left - Left position, relative to parent
      top - Top position, relative to parent
      right - Right position, relative to parent
      bottom - Bottom position, relative to parent
    • requestChildFocus

      public void requestChildFocus(View child, View focused)
      Description copied from interface: ViewParent
      Called when a child of this parent wants focus
      Specified by:
      requestChildFocus in interface ViewParent
      Overrides:
      requestChildFocus in class ViewGroup
      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
    • clearChildFocus

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

      public void clearFocus()
      Description copied from class: View
      Called when this view wants to give up focus. If focus is cleared View.onFocusChanged(boolean, int, Rect) is called.

      Note: When not in touch-mode, the framework will try to give focus to the first focusable View from the top after focus is cleared. 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 which the framework will give focus to this view.

      Overrides:
      clearFocus in class ViewGroup