Build 1.0_r1(from source)

android.widget
Class ViewAnimator

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.FrameLayout
              extended by android.widget.ViewAnimator
All Implemented Interfaces:
Drawable.Callback, KeyEvent.Callback, ViewManager, ViewParent
Direct Known Subclasses:
ViewFlipper, ViewSwitcher

public class ViewAnimator
extends FrameLayout

Base class for a FrameLayout container that will perform animations when switching between its views.


Nested Class Summary
 
Nested classes/interfaces inherited from class android.widget.FrameLayout
FrameLayout.LayoutParams
 
Nested classes/interfaces inherited from class android.view.ViewGroup
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener
 
Field Summary
(package private)  boolean mAnimateFirstTime
           
(package private)  boolean mFirstTime
           
(package private)  Animation mInAnimation
           
(package private)  Animation mOutAnimation
           
(package private)  int mWhichChild
           
 
Fields inherited from class android.widget.FrameLayout
mMeasureAllChildren
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIRST_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, INVISIBLE, KEEP_SCREEN_ON, LAST_STATE_SET, mBottom, mContext, mCurrentAnimation, MIDDLE_STATE_SET, mLayoutParams, mLeft, mLocation, mMeasuredHeight, mMeasuredWidth, mOnClickListener, mOnCreateContextMenuListener, mOnFocusChangeListener, mOnLongClickListener, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FIRST_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_LAST_STATE_SET, PRESSED_MIDDLE_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_SINGLE_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SINGLE_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
ViewAnimator(Context context)
           
ViewAnimator(Context context, AttributeSet attrs)
           
 
Method Summary
 void addView(View child, int index, ViewGroup.LayoutParams params)
          Adds a child view with the specified layout parameters.
 int getBaseline()
          Return the offset of the widget's text baseline from the widget's top boundary.
 View getCurrentView()
          Returns the View corresponding to the currently displayed child.
 int getDisplayedChild()
          Returns the index of the currently displayed child view.
 Animation getInAnimation()
          Returns the current animation used to animate a View that enters the screen.
 Animation getOutAnimation()
          Returns the current animation used to animate a View that exits the screen.
 void setAnimateFirstView(boolean animate)
          Indicates whether the current View should be animated the first time the ViewAnimation is displayed.
 void setDisplayedChild(int whichChild)
          Sets which child view will be displayed.
 void setInAnimation(Animation inAnimation)
          Specifies the animation used to animate a View that enters the screen.
 void setInAnimation(Context context, int resourceID)
          Specifies the animation used to animate a View that enters the screen.
 void setOutAnimation(Animation outAnimation)
          Specifies the animation used to animate a View that exit the screen.
 void setOutAnimation(Context context, int resourceID)
          Specifies the animation used to animate a View that exit the screen.
 void showNext()
          Manually shows the next child.
(package private)  void showOnly(int childIndex)
          Shows only the specified child.
 void showPrevious()
          Manually shows the previous child.
 
Methods inherited from class android.widget.FrameLayout
checkLayoutParams, draw, drawableStateChanged, gatherTransparentRegion, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getConsiderGoneChildrenWhenMeasuring, getForeground, onLayout, onMeasure, onSizeChanged, setForeground, setForegroundGravity, setMeasureAllChildren, verifyDrawable
 
Methods inherited from class android.view.ViewGroup
addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchFreezeSelfOnly, dispatchKeyEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawChild, findFocus, findViewTraversal, findViewWithTagTraversal, fitSystemWindows, focusableViewAvailable, focusSearch, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, showContextMenuForChild, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
applyDrawableToTransparentRegion, bringToFront, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, debug, debugIndent, destroyDrawingCache, dispatchKeyShortcutEvent, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBottom, getBottomFadingEdgeStrength, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInTouchMode, isLayoutRequested, isLongClickable, isPressed, isRootNamespace, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCreateContextMenu, onDetachedFromWindow, onDraw, onFinishInflate, onFocusChanged, onKeyDown, onKeyMultiple, onKeyShortcut, onKeyUp, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onTouchEvent, onTrackballEvent, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setFrame, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setIsRootNamespace, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollBarStyle, setSelected, setSoundEffectsEnabled, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
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

mWhichChild

int mWhichChild

mFirstTime

boolean mFirstTime

mAnimateFirstTime

boolean mAnimateFirstTime

mInAnimation

Animation mInAnimation

mOutAnimation

Animation mOutAnimation
Constructor Detail

ViewAnimator

public ViewAnimator(Context context)

ViewAnimator

public ViewAnimator(Context context,
                    AttributeSet attrs)
Method Detail

setDisplayedChild

public void setDisplayedChild(int whichChild)
Sets which child view will be displayed.

Parameters:
whichChild - the index of the child view to display

getDisplayedChild

public int getDisplayedChild()
Returns the index of the currently displayed child view.


showNext

public void showNext()
Manually shows the next child.


showPrevious

public void showPrevious()
Manually shows the previous child.


showOnly

void showOnly(int childIndex)
Shows only the specified child. The other displays Views exit the screen with the out animation and the specified child enters the screen with the in animation.

Parameters:
childIndex - The index of the child to be shown.

addView

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

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

getCurrentView

public View getCurrentView()
Returns the View corresponding to the currently displayed child.

Returns:
The View currently displayed.
See Also:
getDisplayedChild()

getInAnimation

public Animation getInAnimation()
Returns the current animation used to animate a View that enters the screen.

Returns:
An Animation or null if none is set.
See Also:
setInAnimation(android.view.animation.Animation), setInAnimation(android.content.Context, int)

setInAnimation

public void setInAnimation(Animation inAnimation)
Specifies the animation used to animate a View that enters the screen.

Parameters:
inAnimation - The animation started when a View enters the screen.
See Also:
getInAnimation(), setInAnimation(android.content.Context, int)

getOutAnimation

public Animation getOutAnimation()
Returns the current animation used to animate a View that exits the screen.

Returns:
An Animation or null if none is set.
See Also:
setOutAnimation(android.view.animation.Animation), setOutAnimation(android.content.Context, int)

setOutAnimation

public void setOutAnimation(Animation outAnimation)
Specifies the animation used to animate a View that exit the screen.

Parameters:
outAnimation - The animation started when a View exit the screen.
See Also:
getOutAnimation(), setOutAnimation(android.content.Context, int)

setInAnimation

public void setInAnimation(Context context,
                           int resourceID)
Specifies the animation used to animate a View that enters the screen.

Parameters:
context - The application's environment.
resourceID - The resource id of the animation.
See Also:
getInAnimation(), setInAnimation(android.view.animation.Animation)

setOutAnimation

public void setOutAnimation(Context context,
                            int resourceID)
Specifies the animation used to animate a View that exit the screen.

Parameters:
context - The application's environment.
resourceID - The resource id of the animation.
See Also:
getOutAnimation(), setOutAnimation(android.view.animation.Animation)

setAnimateFirstView

public void setAnimateFirstView(boolean animate)
Indicates whether the current View should be animated the first time the ViewAnimation is displayed.

Parameters:
animate - True to animate the current View the first time it is displayed, false otherwise.

getBaseline

public int getBaseline()
Description copied from class: View

Return the offset of the widget's text baseline from the widget's top boundary. If this widget does not support baseline alignment, this method returns -1.

Overrides:
getBaseline in class View
Returns:
the offset of the baseline within the widget's bounds or -1 if baseline alignment is not supported

Build 1.0_r1(from source)

Please submit a feedback, bug or feature