|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
android.view.ViewGroup
public abstract class ViewGroup
A ViewGroup is a special view that can contain other views
(called children.) The view group is the base class for layouts and views
containers. This class also defines the
ViewGroup.LayoutParams class which serves as the base
class for layouts parameters.
Also see ViewGroup.LayoutParams for layout attributes.
| Nested Class Summary | |
|---|---|
static class |
ViewGroup.LayoutParams
LayoutParams are used by views to tell their parents how they want to be laid out. |
static class |
ViewGroup.MarginLayoutParams
Per-child layout information for layouts that support margins. |
static interface |
ViewGroup.OnHierarchyChangeListener
Interface definition for a callback to be invoked when the hierarchy within this view changed. |
| Nested classes/interfaces inherited from class android.view.View |
|---|
View.AttachInfo, View.BaseSavedState, View.CheckForLongPress, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener |
| Field Summary | |
|---|---|
protected static int |
CLIP_TO_PADDING_MASK
We clip to padding when FLAG_CLIP_TO_PADDING and FLAG_PADDING_NOT_NULL are set at the same time. |
protected static int |
FLAG_SUPPORT_STATIC_TRANSFORMATIONS
When set, this ViewGroup supports static transformations on children; this causes getChildStaticTransformation(View, android.view.animation.Transformation) to be
invoked when a child is drawn. |
protected static int |
FLAG_USE_CHILD_DRAWING_ORDER
When set, the drawing method will call getChildDrawingOrder(int, int)
to get the index of the child to draw for that iteration. |
static int |
FOCUS_AFTER_DESCENDANTS
This view will get focus only if none of its descendants want it. |
static int |
FOCUS_BEFORE_DESCENDANTS
This view will get focus before any of its descendants. |
static int |
FOCUS_BLOCK_DESCENDANTS
This view will block any of its descendants from getting focus, even if they are focusable. |
protected ArrayList<View> |
mDisappearingChildren
Views which have been hidden or removed which need to be animated on their way out. |
protected int |
mGroupFlags
Internal flags. |
protected ViewGroup.OnHierarchyChangeListener |
mOnHierarchyChangeListener
Listener used to propagate events indicating when children are added and/or removed from a view group. |
protected int |
mPersistentDrawingCache
Indicates which types of drawing caches are to be kept in memory. |
static int |
PERSISTENT_ALL_CACHES
Used to indicate that all drawing caches should be kept in memory. |
static int |
PERSISTENT_ANIMATION_CACHE
Used to indicate that the animation drawing cache should be kept in memory. |
static int |
PERSISTENT_NO_CACHE
Used to indicate that no drawing cache should be kept in memory. |
static int |
PERSISTENT_SCROLLING_CACHE
Used to indicate that the scrolling drawing cache should be kept in memory. |
| Constructor Summary | |
|---|---|
ViewGroup(Context context)
|
|
ViewGroup(Context context,
AttributeSet attrs)
|
|
ViewGroup(Context context,
AttributeSet attrs,
int defStyle)
|
|
| Method Summary | |
|---|---|
void |
addFocusables(ArrayList<View> views,
int direction)
Add any focusable views that are descendants of this view (possibly including this view if it is focusable itself) to views. |
boolean |
addStatesFromChildren()
Returns whether this ViewGroup's drawable states also include its children's drawable states. |
void |
addTouchables(ArrayList<View> views)
Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views. |
void |
addView(View child)
Adds a child view. |
void |
addView(View child,
int index)
Adds a child view. |
void |
addView(View child,
int width,
int height)
Adds a child view with this ViewGroup's default layout parameters and the specified width and height. |
void |
addView(View child,
int index,
ViewGroup.LayoutParams params)
Adds a child view with the specified layout parameters. |
void |
addView(View child,
ViewGroup.LayoutParams params)
Adds a child view with the specified layout parameters. |
protected boolean |
addViewInLayout(View child,
int index,
ViewGroup.LayoutParams params)
Adds a view during layout. |
protected boolean |
addViewInLayout(View child,
int index,
ViewGroup.LayoutParams params,
boolean preventRequestLayout)
Adds a view during layout. |
protected void |
attachLayoutAnimationParameters(View child,
ViewGroup.LayoutParams params,
int index,
int count)
Subclasses should override this method to set layout animation parameters on the supplied child. |
protected void |
attachViewToParent(View child,
int index,
ViewGroup.LayoutParams params)
Attaches a view to this view group. |
void |
bringChildToFront(View child)
Change the z order of the child so it's on top of all other children |
protected boolean |
canAnimate()
Indicates whether the view group has the ability to animate its children after the first layout. |
protected boolean |
checkLayoutParams(ViewGroup.LayoutParams p)
|
void |
childDrawableStateChanged(View child)
If {link #addStatesFromChildren} is true, refreshes this group's drawable state (to include the states from its children). |
protected void |
cleanupLayoutState(View child)
Prevents the specified child to be laid out during the next layout pass. |
void |
clearChildFocus(View child)
Called when a child of this parent is giving up focus |
void |
clearDisappearingChildren()
Removes any pending animations for views that have been removed. |
void |
clearFocus()
Called when this view wants to give up focus. |
protected void |
debug(int depth)
Prints information about this view in the log output, with the tag View.VIEW_LOG_TAG. |
protected void |
detachAllViewsFromParent()
Detaches all views from theparent. |
protected void |
detachViewFromParent(int index)
Detaches a view from its parent. |
protected void |
detachViewFromParent(View child)
Detaches a view from its parent. |
protected void |
detachViewsFromParent(int start,
int count)
Detaches a range of view from their parent. |
(package private) void |
dispatchAttachedToWindow(View.AttachInfo info,
int visibility)
|
(package private) void |
dispatchCollectViewAttributes(int visibility)
Private function to aggregate all per-view attributes in to the view root. |
(package private) void |
dispatchDetachedFromWindow()
|
protected void |
dispatchDraw(Canvas canvas)
Called by draw to draw the child views. |
protected void |
dispatchFreezeSelfOnly(SparseArray<Parcelable> container)
Perform dispatching of a freeze() to only this view,
not to its children. |
boolean |
dispatchKeyEvent(KeyEvent event)
Dispatch a key event to the next view on the focus path. |
protected void |
dispatchRestoreInstanceState(SparseArray<Parcelable> container)
Called by View.restoreHierarchyState(android.util.SparseArray to retrieve the state for this view and its
children. |
protected void |
dispatchSaveInstanceState(SparseArray<Parcelable> container)
Called by View.saveHierarchyState(android.util.SparseArray to store the state for this view and its children. |
protected void |
dispatchSetPressed(boolean pressed)
Dispatch setPressed to all of this View's children. |
void |
dispatchSetSelected(boolean selected)
Dispatch setSelected to all of this View's children. |
protected void |
dispatchThawSelfOnly(SparseArray<Parcelable> container)
Perform dispatching of a thaw() to only this view,
not to its children. |
boolean |
dispatchTouchEvent(MotionEvent ev)
Pass the touch screen motion event down to the target view, or this view if it is the target. |
boolean |
dispatchTrackballEvent(MotionEvent event)
Pass a trackball motion event down to the focused view. |
boolean |
dispatchUnhandledMove(View focused,
int direction)
This method is the last chance for the focused view and its ancestors to respond to an arrow key. |
void |
dispatchWindowFocusChanged(boolean hasFocus)
Called when the window containing this view gains or loses window focus. |
void |
dispatchWindowVisibilityChanged(int visibility)
Dispatch a window visibility change down the view hierarchy. |
protected void |
drawableStateChanged()
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown. |
protected boolean |
drawChild(Canvas canvas,
View child,
long drawingTime)
Draw one child of this View Group. |
View |
findFocus()
Find the view in the hierarchy rooted at this view that currently has focus. |
protected View |
findViewTraversal(int id)
|
protected View |
findViewWithTagTraversal(Object tag)
|
protected boolean |
fitSystemWindows(Rect insets)
Apply the insets for system windows to this view, if the FITS_SYSTEM_WINDOWS flag is set |
void |
focusableViewAvailable(View v)
Tells the parent that a new focusable view has become available. |
View |
focusSearch(View focused,
int direction)
Find the nearest view in the specified direction that wants to take focus. |
boolean |
gatherTransparentRegion(Region region)
This is used by the RootView to perform an optimization when the view hierarchy contains one or several SurfaceView. |
protected ViewGroup.LayoutParams |
generateDefaultLayoutParams()
Returns a set of default layout parameters. |
ViewGroup.LayoutParams |
generateLayoutParams(AttributeSet attrs)
Returns a new set of layout parameters based on the supplied attributes set. |
protected ViewGroup.LayoutParams |
generateLayoutParams(ViewGroup.LayoutParams p)
Returns a safe set of layout parameters based on the supplied layout params. |
View |
getChildAt(int index)
Returns the view at the specified position in the group. |
int |
getChildCount()
Returns the number of children in the group. |
protected int |
getChildDrawingOrder(int childCount,
int i)
Returns the index of the child to draw for this iteration. |
static int |
getChildMeasureSpec(int spec,
int padding,
int childDimension)
Does the hard part of measureChildren: figuring out the MeasureSpec to pass to a particular child. |
protected boolean |
getChildStaticTransformation(View child,
Transformation t)
|
boolean |
getChildVisibleRect(View child,
Rect r,
Point offset)
|
int |
getDescendantFocusability()
Gets the descendant focusability of this view group. |
View |
getFocusedChild()
Returns the focused child of this view, if any. |
LayoutAnimationController |
getLayoutAnimation()
Returns the layout animation controller used to animate the group's children. |
Animation.AnimationListener |
getLayoutAnimationListener()
Returns the animation listener to which layout animation events are sent. |
int |
getPersistentDrawingCache()
Returns an integer indicating what types of drawing caches are kept in memory. |
(package private) void |
handleFocusGainInternal(int direction,
Rect previouslyFocusedRect)
Give this view focus. |
boolean |
hasFocus()
Returns true if this view has or contains focus |
boolean |
hasFocusable()
Returns true if this view is focusable or if it contains a reachable View for which View.hasFocusable() returns true. |
int |
indexOfChild(View child)
Returns the position in the group of the specified child view. |
void |
invalidateChild(View child,
Rect dirty)
Don't call or override this method. |
ViewParent |
invalidateChildInParent(int[] location,
Rect dirty)
Don't call or override this method. |
boolean |
isAlwaysDrawnWithCacheEnabled()
Indicates whether this ViewGroup will always try to draw its children using their drawing cache. |
boolean |
isAnimationCacheEnabled()
Indicates whether the children's drawing cache is used during a layout animation. |
protected boolean |
isChildrenDrawnWithCacheEnabled()
Indicates whether the ViewGroup is currently drawing its children using their drawing cache. |
protected void |
measureChild(View child,
int parentWidthMeasureSpec,
int parentHeightMeasureSpec)
Ask one of the children of this view to measure itself, taking into account both the MeasureSpec requirements for this view and its padding. |
protected void |
measureChildren(int widthMeasureSpec,
int heightMeasureSpec)
Ask all of the children of this view to measure themselves, taking into account both the MeasureSpec requirements for this view and its padding. |
protected void |
measureChildWithMargins(View child,
int parentWidthMeasureSpec,
int widthUsed,
int parentHeightMeasureSpec,
int heightUsed)
Ask one of the children of this view to measure itself, taking into account both the MeasureSpec requirements for this view and its padding and margins. |
void |
offsetChildrenTopAndBottom(int offset)
Offset the vertical location of all children of this view by the specified number of pixels. |
void |
offsetDescendantRectToMyCoords(View descendant,
Rect rect)
Offset a rectangle that is in a descendant's coordinate space into our coordinate space. |
(package private) void |
offsetRectBetweenParentAndChild(View descendant,
Rect rect,
boolean offsetFromChildToParent,
boolean clipToBounds)
Helper method that offsets a rect either from parent to descendant or descendant to parent. |
void |
offsetRectIntoDescendantCoords(View descendant,
Rect rect)
Offset a rectangle that is in our coordinate space into an ancestor's coordinate space. |
protected void |
onAnimationEnd()
Invoked by a parent ViewGroup to notify the end of the animation currently associated with this view. |
protected void |
onAnimationStart()
Invoked by a parent ViewGroup to notify the start of the animation currently associated with this view. |
protected int[] |
onCreateDrawableState(int extraSpace)
Generate the new Drawable state for
this view. |
boolean |
onInterceptTouchEvent(MotionEvent ev)
Implement this method to intercept all touch screen motion events. |
protected abstract void |
onLayout(boolean changed,
int l,
int t,
int r,
int b)
Called from layout when this view should assign a size and position to each of its children. |
protected boolean |
onRequestFocusInDescendants(int direction,
Rect previouslyFocusedRect)
Look for a descendant to call View.requestFocus() on. |
void |
recomputeViewAttributes(View child)
Tell view hierarchy that the global view attributes need to be re-evaluated. |
void |
removeAllViews()
Call this method to remove all child views from the ViewGroup. |
void |
removeAllViewsInLayout()
Called by a ViewGroup subclass to remove child views from itself, when it must first know its size on screen before it can calculate how many child views it will render. |
protected void |
removeDetachedView(View child,
boolean animate)
Finishes the removal of a detached view. |
void |
removeView(View view)
|
void |
removeViewAt(int index)
Removes the view at the specified position in the group. |
void |
removeViewInLayout(View view)
Removes a view during layout. |
void |
removeViews(int start,
int count)
Removes the specified range of views from the group. |
void |
removeViewsInLayout(int start,
int count)
Removes a range of views during layout. |
void |
requestChildFocus(View child,
View focused)
Called when a child of this parent wants focus |
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. |
void |
requestDisallowInterceptTouchEvent(boolean disallowIntercept)
Called when a child does not want this parent and its ancestors to intercept touch events with onInterceptTouchEvent(MotionEvent). |
boolean |
requestFocus(int direction,
Rect previouslyFocusedRect)
Call this to try to give focus to a specific view or to one of its descendants and give it hints about the direction and a specific rectangle that the focus is coming from. |
void |
requestTransparentRegion(View child)
Called when a child wants the view hierarchy to gather and report transparent regions to the window compositor. |
void |
scheduleLayoutAnimation()
Schedules the layout animation to be played after the next layout pass of this view group. |
void |
setAddStatesFromChildren(boolean addsStates)
Sets whether this ViewGroup's drawable states also include its children's drawable states. |
void |
setAlwaysDrawnWithCacheEnabled(boolean always)
Indicates whether this ViewGroup will always try to draw its children using their drawing cache. |
void |
setAnimationCacheEnabled(boolean enabled)
Enables or disables the children's drawing cache during a layout animation. |
protected void |
setChildrenDrawingCacheEnabled(boolean enabled)
Enables or disables the drawing cache for each child of this view group. |
protected void |
setChildrenDrawnWithCacheEnabled(boolean enabled)
Tells the ViewGroup to draw its children using their drawing cache. |
void |
setClipChildren(boolean clipChildren)
By default, children are clipped to their bounds before drawing. |
void |
setClipToPadding(boolean clipToPadding)
By default, children are clipped to the padding of the ViewGroup. |
void |
setDescendantFocusability(int focusability)
Set the descendant focusability of this view group. |
void |
setLayoutAnimation(LayoutAnimationController controller)
Sets the layout animation controller used to animate the group's children after the first layout. |
void |
setLayoutAnimationListener(Animation.AnimationListener animationListener)
Specifies the animation listener to which layout animation events must be sent. |
void |
setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
Register a callback to be invoked when a child is added to or removed from this view. |
void |
setPadding(int left,
int top,
int right,
int bottom)
Sets the padding. |
void |
setPersistentDrawingCache(int drawingCacheToKeep)
Indicates what types of drawing caches should be kept in memory after they have been created. |
boolean |
showContextMenuForChild(View originalView)
Bring up a context menu for the specified view or its ancestors. |
void |
startLayoutAnimation()
Runs the layout animation. |
(package private) void |
unFocus()
Called internally by the view system when a new view is getting focus. |
void |
updateViewLayout(View view,
ViewGroup.LayoutParams params)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface android.view.ViewParent |
|---|
createContextMenu, getParent, isLayoutRequested, requestLayout |
| Field Detail |
|---|
protected ArrayList<View> mDisappearingChildren
protected ViewGroup.OnHierarchyChangeListener mOnHierarchyChangeListener
protected int mGroupFlags
protected static final int FLAG_USE_CHILD_DRAWING_ORDER
getChildDrawingOrder(int, int)
to get the index of the child to draw for that iteration.
protected static final int FLAG_SUPPORT_STATIC_TRANSFORMATIONS
getChildStaticTransformation(View, android.view.animation.Transformation) to be
invoked when a child is drawn.
Any subclass overriding
getChildStaticTransformation(View, android.view.animation.Transformation) should
set this flags in mGroupFlags.
This flag needs to be removed until we can add a setter for it. People
can't be directly stuffing values in to mGroupFlags!!!
public static final int FOCUS_BEFORE_DESCENDANTS
public static final int FOCUS_AFTER_DESCENDANTS
public static final int FOCUS_BLOCK_DESCENDANTS
protected int mPersistentDrawingCache
public static final int PERSISTENT_NO_CACHE
public static final int PERSISTENT_ANIMATION_CACHE
public static final int PERSISTENT_SCROLLING_CACHE
public static final int PERSISTENT_ALL_CACHES
protected static final int CLIP_TO_PADDING_MASK
| Constructor Detail |
|---|
public ViewGroup(Context context)
public ViewGroup(Context context,
AttributeSet attrs)
public ViewGroup(Context context,
AttributeSet attrs,
int defStyle)
| Method Detail |
|---|
public int getDescendantFocusability()
requestFocus(int, android.graphics.Rect).
FOCUS_BEFORE_DESCENDANTS, FOCUS_AFTER_DESCENDANTS,
FOCUS_BLOCK_DESCENDANTS.public void setDescendantFocusability(int focusability)
requestFocus(int, android.graphics.Rect).
focusability - one of FOCUS_BEFORE_DESCENDANTS, FOCUS_AFTER_DESCENDANTS,
FOCUS_BLOCK_DESCENDANTS.
void handleFocusGainInternal(int direction,
Rect previouslyFocusedRect)
View.onFocusChanged(boolean, int, android.graphics.Rect) to be called.
Note: this does not check whether this View should get focus, it just
gives it focus no matter what. It should only be called internally by framework
code that knows what it is doing, namely View.requestFocus(int, Rect).
handleFocusGainInternal in class Viewdirection - values are View.FOCUS_UP, View.FOCUS_DOWN,
View.FOCUS_LEFT or View.FOCUS_RIGHT. This is the direction which
focus moved when requestFocus() is called. It may not always
apply, in which case use the default View.FOCUS_DOWN.previouslyFocusedRect - The rectangle of the view that had focus
prior in this View's coordinate system.
public void requestChildFocus(View child,
View focused)
requestChildFocus in interface ViewParentchild - 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
focuspublic void focusableViewAvailable(View v)
focusableViewAvailable in interface ViewParentv - The view that has become newly focusablepublic boolean showContextMenuForChild(View originalView)
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.
showContextMenuForChild in interface ViewParentoriginalView - The source view where the context menu was first invoked
public View focusSearch(View focused,
int direction)
focusSearch in interface ViewParentfocused - The view that currently has focusdirection - One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and
FOCUS_RIGHT, or 0 for not applicable.
public boolean requestChildRectangleOnScreen(View child,
Rect rectangle,
boolean immediate)
ViewGroups overriding this can trust
that:
ViewGroups overriding this should uphold the contract:
child - The direct child making the request.rectangle - The rectangle in the child's coordinates the child
wishes to be on the screen.immediate - True to forbid animated or delayed scrolling,
false otherwise
public boolean dispatchUnhandledMove(View focused,
int direction)
dispatchUnhandledMove in class Viewfocused - The currently focused view.direction - The direction focus wants to move. One of FOCUS_UP,
FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT.
public void clearChildFocus(View child)
clearChildFocus in interface ViewParentchild - The view that is giving up focuspublic void clearFocus()
View.onFocusChanged(boolean, int, android.graphics.Rect) to be called.
clearFocus in class Viewvoid unFocus()
unFocus in class Viewpublic View getFocusedChild()
public boolean hasFocus()
hasFocus in class Viewpublic View findFocus()
View
findFocus in class Viewpublic boolean hasFocusable()
View.hasFocusable() returns true. A "reachable hasFocusable()"
is a View whose parents do not block descendants focus.
Only View.VISIBLE views are considered focusable.
hasFocusable in class ViewFOCUS_BLOCK_DESCENDANTS
public void addFocusables(ArrayList<View> views,
int direction)
addFocusables in class Viewviews - Focusable views found so fardirection - The direction of the focuspublic void dispatchWindowFocusChanged(boolean hasFocus)
dispatchWindowFocusChanged in class ViewhasFocus - True if the window containing this view now has focus,
false otherwise.public void addTouchables(ArrayList<View> views)
addTouchables in class Viewviews - Touchable views found so farpublic void dispatchWindowVisibilityChanged(int visibility)
dispatchWindowVisibilityChanged in class Viewvisibility - The new visibility of the window.View.onWindowVisibilityChanged(int)public void recomputeViewAttributes(View child)
recomputeViewAttributes in interface ViewParentchild - View whose attributes have changed.void dispatchCollectViewAttributes(int visibility)
View
dispatchCollectViewAttributes in class Viewpublic void bringChildToFront(View child)
bringChildToFront in interface ViewParentpublic boolean dispatchKeyEvent(KeyEvent event)
dispatchKeyEvent in class Viewevent - The key event to be dispatched.
public boolean dispatchTrackballEvent(MotionEvent event)
dispatchTrackballEvent in class Viewevent - The motion event to be dispatched.
public boolean dispatchTouchEvent(MotionEvent ev)
dispatchTouchEvent in class Viewev - The motion event to be dispatched.
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
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.
requestDisallowInterceptTouchEvent in interface ViewParentdisallowIntercept - True if the child does not want the parent to
intercept touch events.public boolean onInterceptTouchEvent(MotionEvent ev)
Using this function takes some care, as it has a fairly complicated
interaction with View.onTouchEvent(MotionEvent), and using it requires implementing
that method as well as this one in the correct way. Events will be
received in the following order:
MotionEvent.ACTION_CANCEL, and all further
events will be delivered to your onTouchEvent() method and no longer
appear here.
ev - The motion event being dispatched down the hierarchy.
public boolean requestFocus(int direction,
Rect previouslyFocusedRect)
View.isFocusable() returns false),
or if it is focusable and it is not focusable in touch mode (View.isFocusableInTouchMode())
while the device is in touch mode.
A View will not take focus if it is not visible.
A View will not take focus if one of its parents has getDescendantFocusability()
equal to FOCUS_BLOCK_DESCENDANTS.
See also View.focusSearch(int), which is what you call to say that you
have focus, and you want your parent to look for the next one.
You may wish to override this method if your custom View has an internal
View that it wishes to forward the request to.
Looks for a view to give focus to respecting the setting specified by
getDescendantFocusability().
Uses onRequestFocusInDescendants(int, android.graphics.Rect) to
find focus within the children of this group when appropriate.
requestFocus in class Viewdirection - One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHTpreviouslyFocusedRect - 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.
FOCUS_BEFORE_DESCENDANTS,
FOCUS_AFTER_DESCENDANTS,
FOCUS_BLOCK_DESCENDANTS,
onRequestFocusInDescendants(int, android.graphics.Rect)
protected boolean onRequestFocusInDescendants(int direction,
Rect previouslyFocusedRect)
View.requestFocus() on.
Called by requestFocus(int, android.graphics.Rect)
when it wants to request focus within its children. Override this to
customize how your ViewGroup requests focus within its children.
direction - One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHTpreviouslyFocusedRect - 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.
void dispatchAttachedToWindow(View.AttachInfo info,
int visibility)
dispatchAttachedToWindow in class Viewinfo - the View.AttachInfo to associated with
this viewvoid dispatchDetachedFromWindow()
dispatchDetachedFromWindow in class View
public void setPadding(int left,
int top,
int right,
int bottom)
View.getPaddingLeft(), View.getPaddingTop(),
View.getPaddingRight() and View.getPaddingBottom() may be different
from the values set in this call.
setPadding in class Viewleft - the left padding in pixelstop - the top padding in pixelsright - the right padding in pixelsbottom - the bottom padding in pixelsprotected void dispatchSaveInstanceState(SparseArray<Parcelable> container)
View.saveHierarchyState(android.util.SparseArray) to store the state for this view and its children.
May be overridden to modify how freezing happens to a view's children; for example, some
views may want to not store state for their children.
dispatchSaveInstanceState in class Viewcontainer - The SparseArray in which to save the view's state.View.dispatchRestoreInstanceState(android.util.SparseArray) ,
View.saveHierarchyState(android.util.SparseArray) ,
View.onSaveInstanceState()protected void dispatchFreezeSelfOnly(SparseArray<Parcelable> container)
freeze() to only this view,
not to its children. For use when overriding
dispatchFreeze() to allow subclasses to freeze
their own state but not the state of their children.
container - the containerprotected void dispatchRestoreInstanceState(SparseArray<Parcelable> container)
View.restoreHierarchyState(android.util.SparseArray) to retrieve the state for this view and its
children. May be overridden to modify how restoreing happens to a view's children; for
example, some views may want to not store state for their children.
dispatchRestoreInstanceState in class Viewcontainer - The SparseArray which holds previously saved state.View.dispatchSaveInstanceState(android.util.SparseArray) ,
View.restoreHierarchyState(android.util.SparseArray) ,
View.onRestoreInstanceState(android.os.Parcelable)protected void dispatchThawSelfOnly(SparseArray<Parcelable> container)
thaw() to only this view,
not to its children. For use when overriding
dispatchThaw() to allow subclasses to thaw
their own state but not the state of their children.
container - the containerprotected void setChildrenDrawingCacheEnabled(boolean enabled)
enabled - true to enable the cache, false to dispose of itprotected void onAnimationStart()
View
onAnimationStart in class ViewView.setAnimation(android.view.animation.Animation),
View.getAnimation()protected void onAnimationEnd()
View
onAnimationEnd in class ViewView.setAnimation(android.view.animation.Animation),
View.getAnimation()protected void dispatchDraw(Canvas canvas)
dispatchDraw in class Viewcanvas - the canvas on which to draw the view
protected int getChildDrawingOrder(int childCount,
int i)
NOTE: In order for this method to be called, the
FLAG_USE_CHILD_DRAWING_ORDER must be set.
i - The current iteration.
protected boolean drawChild(Canvas canvas,
View child,
long drawingTime)
canvas - The canvas on which to draw the childchild - Who to drawdrawingTime - The time at which draw is occuring
public void setClipChildren(boolean clipChildren)
clipChildren - true to clip children to their bounds,
false otherwisepublic void setClipToPadding(boolean clipToPadding)
clipToPadding - true to clip children to the padding of the
group, false otherwisepublic void dispatchSetSelected(boolean selected)
dispatchSetSelected in class Viewselected - The new selected stateView.setSelected(boolean)protected void dispatchSetPressed(boolean pressed)
View
dispatchSetPressed in class Viewpressed - The new pressed stateView.setPressed(boolean)
protected boolean getChildStaticTransformation(View child,
Transformation t)
protected View findViewTraversal(int id)
findViewTraversal in class Viewid - the id of the view to be found
protected View findViewWithTagTraversal(Object tag)
findViewWithTagTraversal in class Viewtag - the tag of the view to be found
public void addView(View child)
child - the child view to addgenerateDefaultLayoutParams()
public void addView(View child,
int index)
child - the child view to addindex - the position at which to add the childgenerateDefaultLayoutParams()
public void addView(View child,
int width,
int height)
child - the child view to add
public void addView(View child,
ViewGroup.LayoutParams params)
addView in interface ViewManagerchild - the child view to addparams - the layout parameters to set on the child
public void addView(View child,
int index,
ViewGroup.LayoutParams params)
child - the child view to addindex - the position at which to add the childparams - the layout parameters to set on the child
public void updateViewLayout(View view,
ViewGroup.LayoutParams params)
updateViewLayout in interface ViewManagerprotected boolean checkLayoutParams(ViewGroup.LayoutParams p)
public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
listener - the callback to invoke on hierarchy change
protected boolean addViewInLayout(View child,
int index,
ViewGroup.LayoutParams params)
child - the view to add to the groupindex - the index at which the child must be addedparams - the layout parameters to associate with the child
protected boolean addViewInLayout(View child,
int index,
ViewGroup.LayoutParams params,
boolean preventRequestLayout)
child - the view to add to the groupindex - the index at which the child must be addedparams - the layout parameters to associate with the childpreventRequestLayout - if true, calling this method will not trigger a
layout request on child
protected void cleanupLayoutState(View child)
child - the child on which to perform the cleanup
protected void attachLayoutAnimationParameters(View child,
ViewGroup.LayoutParams params,
int index,
int count)
child - the child to associate with animation parametersparams - the child's layout parameters which hold the animation
parametersindex - the index of the child in the view groupcount - the number of children in the view grouppublic void removeView(View view)
removeView in interface ViewManagerpublic void removeViewInLayout(View view)
view - the view to remove from the group
public void removeViewsInLayout(int start,
int count)
start - the index of the first view to remove from the groupcount - the number of views to remove from the grouppublic void removeViewAt(int index)
index - the position in the group of the view to remove
public void removeViews(int start,
int count)
start - the first position in the group of the range of views to removecount - the number of views to removepublic void removeAllViews()
public void removeAllViewsInLayout()
protected void removeDetachedView(View child,
boolean animate)
child - the child to be definitely removed from the view hierarchyanimate - if true and the view has an animation, the view is placed in the
disappearing views list, otherwise, it is detached from the windowattachViewToParent(View, int, android.view.ViewGroup.LayoutParams),
detachAllViewsFromParent(),
detachViewFromParent(View),
detachViewFromParent(int)
protected void attachViewToParent(View child,
int index,
ViewGroup.LayoutParams params)
getChildAt(int).
This method should be called only for view which were detached from their parent.
child - the child to attachindex - the index at which the child should be attachedparams - the layout parameters of the childremoveDetachedView(View, boolean),
detachAllViewsFromParent(),
detachViewFromParent(View),
detachViewFromParent(int)protected void detachViewFromParent(View child)
attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)
or a call to removeDetachedView(View, boolean). When a view is detached,
its parent is null and cannot be retrieved by a call to getChildAt(int).
child - the child to detachdetachViewFromParent(int),
detachViewsFromParent(int, int),
detachAllViewsFromParent(),
attachViewToParent(View, int, android.view.ViewGroup.LayoutParams),
removeDetachedView(View, boolean)protected void detachViewFromParent(int index)
attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)
or a call to removeDetachedView(View, boolean). When a view is detached,
its parent is null and cannot be retrieved by a call to getChildAt(int).
index - the index of the child to detachdetachViewFromParent(View),
detachAllViewsFromParent(),
detachViewsFromParent(int, int),
attachViewToParent(View, int, android.view.ViewGroup.LayoutParams),
removeDetachedView(View, boolean)
protected void detachViewsFromParent(int start,
int count)
attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)
or a call to removeDetachedView(View, boolean). When a view is detached, its
parent is null and cannot be retrieved by a call to getChildAt(int).
start - the first index of the childrend range to detachcount - the number of children to detachdetachViewFromParent(View),
detachViewFromParent(int),
detachAllViewsFromParent(),
attachViewToParent(View, int, android.view.ViewGroup.LayoutParams),
removeDetachedView(View, boolean)protected void detachAllViewsFromParent()
attachViewToParent(View, int, android.view.ViewGroup.LayoutParams)
or a call to removeDetachedView(View, boolean). When a view is detached,
its parent is null and cannot be retrieved by a call to getChildAt(int).
detachViewFromParent(View),
detachViewFromParent(int),
detachViewsFromParent(int, int),
attachViewToParent(View, int, android.view.ViewGroup.LayoutParams),
removeDetachedView(View, boolean)
public final void invalidateChild(View child,
Rect dirty)
invalidateChild in interface ViewParentchild - The child which is dirtydirty - The area within the child that is invalid
public ViewParent invalidateChildInParent(int[] location,
Rect dirty)
invalidateChildInParent in interface ViewParentlocation - An array of 2 ints containing the left and top
coordinates of the child to invalidatedirty - The area within the child that is invalid
public final void offsetDescendantRectToMyCoords(View descendant,
Rect rect)
descendant - A descendant of this viewrect - A rectangle defined in descendant's coordinate space.
public final void offsetRectIntoDescendantCoords(View descendant,
Rect rect)
descendant - A descendant of this viewrect - A rectangle defined in descendant's coordinate space.
void offsetRectBetweenParentAndChild(View descendant,
Rect rect,
boolean offsetFromChildToParent,
boolean clipToBounds)
public void offsetChildrenTopAndBottom(int offset)
offset - the number of pixels to offset
public boolean getChildVisibleRect(View child,
Rect r,
Point offset)
getChildVisibleRect in interface ViewParent
protected abstract void onLayout(boolean changed,
int l,
int t,
int r,
int b)
onLayout in class Viewchanged - This is a new size or position for this viewl - Left position, relative to parentt - Top position, relative to parentr - Right position, relative to parentb - Bottom position, relative to parentprotected boolean canAnimate()
public void startLayoutAnimation()
public void scheduleLayoutAnimation()
public void setLayoutAnimation(LayoutAnimationController controller)
controller - the animation controllerpublic LayoutAnimationController getLayoutAnimation()
public boolean isAnimationCacheEnabled()
setAnimationCacheEnabled(boolean),
View.setDrawingCacheEnabled(boolean)public void setAnimationCacheEnabled(boolean enabled)
enabled - true to enable the animation cache, false otherwiseisAnimationCacheEnabled(),
View.setDrawingCacheEnabled(boolean)public boolean isAlwaysDrawnWithCacheEnabled()
setAlwaysDrawnWithCacheEnabled(boolean),
setChildrenDrawnWithCacheEnabled(boolean),
View.setDrawingCacheEnabled(boolean)public void setAlwaysDrawnWithCacheEnabled(boolean always)
always - true to always draw with the drawing cache, false otherwiseisAlwaysDrawnWithCacheEnabled(),
setChildrenDrawnWithCacheEnabled(boolean),
View.setDrawingCacheEnabled(boolean),
View.setDrawingCacheQuality(int)protected boolean isChildrenDrawnWithCacheEnabled()
setAlwaysDrawnWithCacheEnabled(boolean),
setChildrenDrawnWithCacheEnabled(boolean)protected void setChildrenDrawnWithCacheEnabled(boolean enabled)
isAlwaysDrawnWithCacheEnabled() is true. A child's drawing cache
will be used only if it has been enabled.
Subclasses should call this method to start and stop using the drawing cache when
they perform performance sensitive operations, like scrolling or animating.
enabled - true if children should be drawn with their cache, false otherwisesetAlwaysDrawnWithCacheEnabled(boolean),
isChildrenDrawnWithCacheEnabled()public int getPersistentDrawingCache()
PERSISTENT_NO_CACHE,
PERSISTENT_ANIMATION_CACHE, PERSISTENT_SCROLLING_CACHE
and PERSISTENT_ALL_CACHESsetPersistentDrawingCache(int),
setAnimationCacheEnabled(boolean)public void setPersistentDrawingCache(int drawingCacheToKeep)
drawingCacheToKeep - one or a combination of PERSISTENT_NO_CACHE,
PERSISTENT_ANIMATION_CACHE, PERSISTENT_SCROLLING_CACHE
and PERSISTENT_ALL_CACHESgetPersistentDrawingCache(),
setAnimationCacheEnabled(boolean)public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
attrs - the attributes to build the layout parameters from
ViewGroup.LayoutParams or one
of its descendantsprotected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
checkLayoutParams(android.view.ViewGroup.LayoutParams), this method
is invoked. This method should return a new set of layout params suitable for
this ViewGroup, possibly by copying the appropriate attributes from the
specified set of layout params.
p - The layout parameters to convert into a suitable set of layout parameters
for this ViewGroup.
ViewGroup.LayoutParams or one
of its descendantsprotected ViewGroup.LayoutParams generateDefaultLayoutParams()
addView(View) has no layout parameters
already set. If null is returned, an exception is thrown from addView.
protected void debug(int depth)
View.VIEW_LOG_TAG. Each line in the output is preceded with an
indentation defined by the depth.
debug in class Viewdepth - the indentation levelpublic int indexOfChild(View child)
child - the view for which to get the position
public int getChildCount()
public View getChildAt(int index)
index - the position at which to get the view from
protected void measureChildren(int widthMeasureSpec,
int heightMeasureSpec)
widthMeasureSpec - The width requirements for this viewheightMeasureSpec - The height requirements for this view
protected void measureChild(View child,
int parentWidthMeasureSpec,
int parentHeightMeasureSpec)
child - The child to measureparentWidthMeasureSpec - The width requirements for this viewparentHeightMeasureSpec - The height requirements for this view
protected void measureChildWithMargins(View child,
int parentWidthMeasureSpec,
int widthUsed,
int parentHeightMeasureSpec,
int heightUsed)
child - The child to measureparentWidthMeasureSpec - The width requirements for this viewwidthUsed - Extra space that has been used up by the parent
horizontally (possibly by other children of the parent)parentHeightMeasureSpec - The height requirements for this viewheightUsed - Extra space that has been used up by the parent
vertically (possibly by other children of the parent)
public static int getChildMeasureSpec(int spec,
int padding,
int childDimension)
spec - The requirements for this viewpadding - The padding of this view for the current dimension and
margins, if applicablechildDimension - How big the child wants to be in the current
dimension
public void clearDisappearingChildren()
public boolean gatherTransparentRegion(Region region)
gatherTransparentRegion in class Viewregion - The transparent region for this ViewRoot (window).
public void requestTransparentRegion(View child)
requestTransparentRegion in interface ViewParentchild - the view requesting the transparent region computationprotected boolean fitSystemWindows(Rect insets)
View
fitSystemWindows in class Viewinsets - Insets for system windows
public Animation.AnimationListener getLayoutAnimationListener()
Animation.AnimationListenerprotected void drawableStateChanged()
ViewBe sure to call through to the superclass when overriding this function.
drawableStateChanged in class ViewDrawable.setState(int[])protected int[] onCreateDrawableState(int extraSpace)
ViewDrawable state for
this view. This is called by the view
system when the cached Drawable state is determined to be invalid. To
retrieve the current state, you should use View.getDrawableState().
onCreateDrawableState in class ViewextraSpace - if non-zero, this is the number of extra entries you
would like in the returned array in which you can place your own
states.
Drawable state of
the view.View.mergeDrawableStates(int[], int[])public void setAddStatesFromChildren(boolean addsStates)
public boolean addStatesFromChildren()
public void childDrawableStateChanged(View child)
childDrawableStateChanged in interface ViewParentchild - The child whose drawable state has changed.public void setLayoutAnimationListener(Animation.AnimationListener animationListener)
Animation.AnimationListener.onAnimationStart(Animation)
and
Animation.AnimationListener.onAnimationEnd(Animation)
are invoked.
animationListener - the layout animation listener
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||