English | Site Directory

Android - An Open Handset Alliance Project

android.view
public interface

android.view.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.

Known Indirect Subclasses

Summary

Public Methods

        void  bringChildToFront(View child)
Change the z order of the child so it's on top of all other children
        void  childDrawableStateChanged(View child)
This method is called on the parent when a child's drawable state has changed.
        void  clearChildFocus(View child)
Called when a child of this parent is giving up focus
        View  focusSearch(View v, int direction)
Find the nearest view in the specified direction that wants to take focus
        void  focusableViewAvailable(View v)
Tells the parent that a new focusable view has become available.
        boolean  getChildVisibleRect(View child, Rect r, Point offset)
        ViewParent  getParent()
Returns the parent if it exists, or null.
        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  populateContextMenu(ContextMenu menu)
Have the parent populate the specified context menu if it has anything to add (and then recurse on its parent).
        void  requestChildFocus(View child, View focused)
Called when a child of this parent wants focus
        void  requestLayout()
Called when something has changed which has invalidated the layout of a child of this view parent.
        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 v)
Bring up a context menu for the specified view or its ancestors

Details

Public Methods

public void bringChildToFront(View child)

Change the z order of the child so it's on top of all other children

public void childDrawableStateChanged(View child)

This method is called on the parent when a child's drawable state has changed.

Parameters

child The child whose drawable state has changed.

public void clearChildFocus(View child)

Called when a child of this parent is giving up focus

Parameters

child The view that is giving up focus

public View focusSearch(View v, int direction)

Find the nearest view in the specified direction that wants to take focus

Parameters

v The view that currently has focus
direction One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT

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.

Parameters

v The view that has become newly focusable

public boolean getChildVisibleRect(View child, Rect r, Point offset)

public ViewParent getParent()

Returns the parent if it exists, or null.

Returns

  • a ViewParent or null if this ViewParent does not have a parent

public void invalidateChild(View child, Rect r)

All or part of a child is dirty and needs to be redrawn.

Parameters

child The child which is dirty
r The area within the child that is invalid

public ViewParent invalidateChildInParent(int[] location, 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.

Parameters

location An array of 2 ints containing the left and top coordinates of the child to invalidate
r The area within the child that is invalid

Returns

  • the parent of this ViewParent or null

public boolean isLayoutRequested()

Indicates whether layout was requested on this view parent.

Returns

  • true if layout was requested, false otherwise

public void populateContextMenu(ContextMenu menu)

Have the parent populate the specified context menu if it has anything to add (and then recurse on its parent).

Parameters

menu The menu to populate

public void requestChildFocus(View child, View focused)

Called when a child of this parent wants focus

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

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 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.

Parameters

child the view requesting the transparent region computation

public boolean showContextMenuForChild(View v)

Bring up a context menu for the specified view or its ancestors

Parameters

v The source view where the context menu was first invoked

Returns

  • trus if a context menu was displayed
Build m5-rc15g - 14 May 2008 12:50