目录

Animation

Class Info

public abstract class Animation

An abstract class for supporting marker animation.

Nested Class Summary

Qualifier and Type

Class Name and Description

public interface

Animation.AnimationListener

Listens for animation movement.

Public Field Summary

Qualifier and Type

Field and Description

static final int

FILL_MODE_BACKWARDS

The first frame is displayed after the animation ends.

static final int

FILL_MODE_FORWARDS

The last frame is displayed after the animation ends.

static final int

INFINITE

The animation is replayed infinitely.

static final int

RESTART

The animation is replayed from the start after it ends. You can call Animation.setRepeatCount(int) to set a limit on the number of replay times.

static final int

REVERSE

The animation is replayed from the end in reverse order after it ends. You can call Animation.setRepeatCount(int) to set a limit on the number of replay times.

Public Constructor Summary

Constructor Name

Animation()

Default constructor of the Animation class.

Public Method Summary

Qualifier and Type

Method Name and Description

int

getFillMode()

Obtains the status after the animation ends.

Interpolator

getInterpolator()

Obtains an interpolator.

Animation.AnimationListener

getListener()

Obtains an animation listener.

int

getRepeatCount()

Obtains the number of times that an animation is replayed.

int

getRepeatMode()

Obtains the animation replay mode.

long

getDuration()

Obtains the animation duration.

void

setAnimationListener(Animation.AnimationListener listener)

Sets a listener.

abstract void

setDuration(long duration)

Sets the animation duration.

void

setFillMode(int fillMode)

Sets the status after the animation ends.

abstract void

setInterpolator(Interpolator interpolator)

Sets an animation interpolator.

void

setRepeatCount(int repeatCount)

Sets the number of times that an animation is replayed.

void

setRepeatMode(int repeatMode)

Sets the animation replay mode. By default, the animation is replayed from the start.

Public Fields

[h2]FILL_MODE_BACKWARDS

Fields

public static final int FILL_MODE_BACKWARDS

The first frame is displayed after the animation ends.

FILL_MODE_BACKWARDS: 1

For other constant values, please refer to Constant-values.

[h2]FILL_MODE_FORWARDS

Fields

public static final int FILL_MODE_FORWARDS

The last frame is displayed after the animation ends.

FILL_MODE_FORWARDS: 0

For other constant values, please refer to Constant-values.

[h2]INFINITE

Fields

public static final int INFINITE

The animation is replayed infinitely.

INFINITE: -1

For other constant values, please refer to Constant-values.

[h2]RESTART

Fields

public static final int RESTART

The animation is replayed from the start after it ends. You can call Animation.setRepeatCount(int) to set a limit on the number of replay times.

RESTART: 1

For other constant values, please refer to Constant-values.

[h2]REVERSE

Fields

public static final int REVERSE

The animation is replayed from the end in reverse order after it ends. You can call Animation.setRepeatCount(int) to set a limit on the number of replay times.

REVERSE: 2

For other constant values, please refer to Constant-values.

Public Methods

[h2]getFillMode

Method

public int getFillMode()

Obtains the status after the animation ends.

Returns

Type

Description

int

Status after the animation ends.

[h2]getInterpolator

Method

public Interpolator getInterpolator()

Obtains an interpolator.

Returns

Type

Description

Interpolator

Interpolator.

[h2]getListener

Method

public Animation.AnimationListener getListener()

Obtains an animation listener.

Returns

Type

Description

Animation.AnimationListener

Animation listener.

[h2]getRepeatCount

Method

public int getRepeatCount()

Obtains the number of times that an animation is replayed.

Returns

Type

Description

int

Number of times that an animation is replayed.

[h2]getRepeatMode

Method

public int getRepeatMode()

Obtains the animation replay mode.

Returns

Type

Description

int

Animation replay mode.

[h2]getDuration

Method

public long getDuration()

Obtains the animation duration.

Returns

Type

Description

long

Animation duration.

[h2]setAnimationListener

Method

public void setAnimationListener(Animation.AnimationListener listener)

Sets a listener.

Parameters

Name

Description

listener

Animation listener.

[h2]setDuration

Method

public abstract void setDuration(long duration)

Sets the animation duration.

Parameters

Name

Description

duration

Animation duration, in milliseconds. The default value is 250.

[h2]setFillMode

Method

public void setFillMode(int fillMode)

Sets the status after the animation ends.

Parameters

Name

Description

fillMode

Status after the animation ends. The options are as follows:

The default value is 0 (FILL_MODE_FORWARDS). If an abnormal value is passed, the default value will be used.

[h2]setInterpolator

Method

public abstract void setInterpolator(Interpolator interpolator)

Sets an animation interpolator.

Parameters

Name

Description

interpolator

Interpolator.

[h2]setRepeatCount

Method

public void setRepeatCount(int repeatCount)

Sets the number of times that an animation is replayed.

Parameters

Name

Description

repeatCount

Number of times that an animation is replayed. The default value is 0. The options are as follows:

  • Positive number: The animation is replayed for the specified number of times.
  • 0: The animation is not replayed.
  • -1: The animation is replayed infinitely.
  • Less than -1: The default value 0 is used.

[h2]setRepeatMode

Method

public void setRepeatMode(int repeatMode)

Sets the animation replay mode. By default, the animation is replayed from the start.

Parameters

Name

Description

repeatMode

Animation replay mode. The options are as follows:

  • RESTART: Replays the animation from the start after it ends.
  • REVERSE: Replays the animation from the end in reverse order after it ends.

The default value is 1 (RESTART). If an abnormal value is passed, the default value will be used.