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!)

open CharSequence!

open Boolean

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

open Int

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

open Unit
removeView(view: View!)

open Unit
removeViewAt(index: Int)

open Unit

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

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

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

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

removeView

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

removeViewAt

Added in API level 1
open fun removeViewAt(index: Int): Unit
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
Parameters
view View!: the view to remove from the group

removeViews

Added in API level 1
open fun removeViews(
    start: Int,
    count: Int
): Unit
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
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.