Added in API level 1

ViewAnimator


open class ViewAnimator : FrameLayout
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ android.widget.ViewAnimator

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

Summary

XML attributes
android:animateFirstView Defines whether to animate the current View when the ViewAnimation is first displayed.
android:inAnimation Identifier for the animation to use when a view is shown.
android:outAnimation Identifier for the animation to use when a view is hidden.
Inherited XML attributes
Inherited constants
Public constructors
ViewAnimator(context: Context!)

ViewAnimator(context: Context!, attrs: AttributeSet!)

Public methods
open Unit
addView(child: View!, index: Int, params: ViewGroup.LayoutParams!)

Adds a child view with the specified layout parameters.

open CharSequence!

Return the class name of this object to be used for accessibility purposes.

open Boolean

Returns whether the current View should be animated the first time the ViewAnimator is displayed.

open Int

Return the offset of the widget's text baseline from the widget's top boundary.

open View!

Returns the View corresponding to the currently displayed child.

open Int

Returns the index of the currently displayed child view.

open Animation!

Returns the current animation used to animate a View that enters the screen.

open Animation!

Returns the current animation used to animate a View that exits the screen.

open Unit

Call this method to remove all child views from the ViewGroup.

open Unit
removeView(view: View!)

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

open Unit
removeViewAt(index: Int)

Removes the view at the specified position in the group.

open Unit

Removes a view during layout.

open Unit
removeViews(start: Int, count: Int)

Removes the specified range of views from the group.

open Unit
removeViewsInLayout(start: Int, count: Int)

Removes a range of views during layout.

open Unit

Indicates whether the current View should be animated the first time the ViewAnimator is displayed.

open Unit
setDisplayedChild(whichChild: Int)

Sets which child view will be displayed.

open Unit
setInAnimation(context: Context!, resourceID: Int)

Specifies the animation used to animate a View that enters the screen.

open Unit
setInAnimation(inAnimation: Animation!)

Specifies the animation used to animate a View that enters the screen.

open Unit
setOutAnimation(context: Context!, resourceID: Int)

Specifies the animation used to animate a View that exit the screen.

open Unit
setOutAnimation(outAnimation: Animation!)

Specifies the animation used to animate a View that exit the screen.

open Unit

Manually shows the next child.

open Unit

Manually shows the previous child.

Inherited functions
Inherited properties

XML attributes

android:animateFirstView

android:animateFirstView
Defines whether to animate the current View when the ViewAnimation is first displayed.

May be a boolean value, such as "true" or "false".

android:inAnimation

android:inAnimation
Identifier for the animation to use when a view is shown.

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

android:outAnimation

android:outAnimation
Identifier for the animation to use when a view is hidden.

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

Public constructors

ViewAnimator

Added in API level 1
ViewAnimator(context: Context!)

ViewAnimator

Added in API level 1
ViewAnimator(
    context: Context!,
    attrs: AttributeSet!)

Public methods

addView

Added in API level 1
open fun addView(
    child: View!,
    index: Int,
    params: ViewGroup.LayoutParams!
): Unit

Adds a child view with the specified layout parameters.

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

Parameters
child View!: the child view to add
index Int: the position at which to add the child or -1 to add last
params ViewGroup.LayoutParams!: the layout parameters to set on the child

getAccessibilityClassName

Added in API level 23
open fun getAccessibilityClassName(): CharSequence!

Return the class name of this object to be used for accessibility purposes. Subclasses should only override this if they are implementing something that should be seen as a completely new class of view when used by accessibility, unrelated to the class it is deriving from. This is used to fill in AccessibilityNodeInfo.setClassName.

getAnimateFirstView

Added in API level 17
open fun getAnimateFirstView(): Boolean

Returns whether the current View should be animated the first time the ViewAnimator is displayed.

Return
Boolean true if the current View will be animated the first time it is displayed, false otherwise.

getBaseline

Added in API level 1
open fun getBaseline(): Int

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.

Return
Int the offset of the baseline within the widget's bounds or -1 if baseline alignment is not supported

getCurrentView

Added in API level 1
open fun getCurrentView(): View!

Returns the View corresponding to the currently displayed child.

Return
View! The View currently displayed.

getDisplayedChild

Added in API level 1
open fun getDisplayedChild(): Int

Returns the index of the currently displayed child view.

getInAnimation

Added in API level 1
open fun getInAnimation(): Animation!

Returns the current animation used to animate a View that enters the screen.

Return
Animation! An Animation or null if none is set.

getOutAnimation

Added in API level 1
open fun getOutAnimation(): Animation!

Returns the current animation used to animate a View that exits the screen.

Return
Animation! An Animation or null if none is set.

removeAllViews

Added in API level 1
open fun removeAllViews(): Unit

Call this method to remove all child views from the ViewGroup.

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

removeView

Added in API level 1
open fun removeView(view: View!): Unit

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

removeViewAt

Added in API level 1
open fun removeViewAt(index: Int): Unit

Removes the view at the specified position in the group.

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

Parameters
index Int: the position in the group of the view to remove

removeViewInLayout

Added in API level 1
open fun removeViewInLayout(view: View!): Unit

Removes a view during layout. This is useful if in your onLayout() method, you need to remove more views.

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

Parameters
view View!: the view to remove from the group

removeViews

Added in API level 1
open fun removeViews(
    start: Int,
    count: Int
): Unit

Removes the specified range of views from the group.

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

Parameters
start Int: the first position in the group of the range of views to remove
count Int: the number of views to remove

removeViewsInLayout

Added in API level 1
open fun removeViewsInLayout(
    start: Int,
    count: Int
): Unit

Removes a range of views during layout. This is useful if in your onLayout() method, you need to remove more views.

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

Parameters
start Int: the index of the first view to remove from the group
count Int: the number of views to remove from the group

setAnimateFirstView

Added in API level 1
open fun setAnimateFirstView(animate: Boolean): Unit

Indicates whether the current View should be animated the first time the ViewAnimator is displayed.

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

setDisplayedChild

Added in API level 1
open fun setDisplayedChild(whichChild: Int): Unit

Sets which child view will be displayed.

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

setInAnimation

Added in API level 1
open fun setInAnimation(
    context: Context!,
    resourceID: Int
): Unit

Specifies the animation used to animate a View that enters the screen.

Parameters
context Context!: The application's environment.
resourceID Int: The resource id of the animation.

setInAnimation

Added in API level 1
open fun setInAnimation(inAnimation: Animation!): Unit

Specifies the animation used to animate a View that enters the screen.

Parameters
inAnimation Animation!: The animation started when a View enters the screen.

setOutAnimation

Added in API level 1
open fun setOutAnimation(
    context: Context!,
    resourceID: Int
): Unit

Specifies the animation used to animate a View that exit the screen.

Parameters
context Context!: The application's environment.
resourceID Int: The resource id of the animation.

setOutAnimation

Added in API level 1
open fun setOutAnimation(outAnimation: Animation!): Unit

Specifies the animation used to animate a View that exit the screen.

Parameters
outAnimation Animation!: The animation started when a View exit the screen.

showNext

Added in API level 1
open fun showNext(): Unit

Manually shows the next child.

showPrevious

Added in API level 1
open fun showPrevious(): Unit

Manually shows the previous child.