public class LottieAnimationView
extends AppCompatImageView
R.styleable#LottieAnimationView_lottie_fileName
2) Programatically: setAnimation(String), setComposition(LottieComposition), or setAnimation(JSONObject).
You may manually set the progress of the animation with setProgress(float)| Modifier and Type | Class and Description |
|---|---|
static class |
LottieAnimationView.CacheStrategy
Caching strategy for compositions that will be reused frequently.
|
| Constructor and Description |
|---|
LottieAnimationView(android.content.Context context) |
LottieAnimationView(android.content.Context context,
android.util.AttributeSet attrs) |
LottieAnimationView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAnimatorListener(android.animation.Animator.AnimatorListener listener) |
void |
addAnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener updateListener) |
void |
cancelAnimation() |
long |
getDuration() |
float |
getProgress() |
void |
invalidateDrawable(android.graphics.drawable.Drawable dr) |
boolean |
isAnimating() |
void |
loop(boolean loop) |
protected void |
onDetachedFromWindow() |
protected void |
onDraw(android.graphics.Canvas canvas) |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
protected void |
onRestoreInstanceState(android.os.Parcelable state) |
protected android.os.Parcelable |
onSaveInstanceState() |
void |
pauseAnimation() |
void |
playAnimation() |
void |
recycleBitmaps() |
void |
removeAnimatorListener(android.animation.Animator.AnimatorListener listener) |
void |
removeUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener updateListener) |
void |
setAnimation(org.json.JSONObject json)
Sets the animation from a JSONObject.
|
void |
setAnimation(java.lang.String animationName)
Sets the animation from a file in the assets directory.
|
void |
setAnimation(java.lang.String animationName,
LottieAnimationView.CacheStrategy cacheStrategy)
Sets the animation from a file in the assets directory.
|
void |
setComposition(LottieComposition composition) |
void |
setProgress(float progress) |
protected boolean |
verifyDrawable(android.graphics.drawable.Drawable drawable) |
public LottieAnimationView(android.content.Context context)
public LottieAnimationView(android.content.Context context,
android.util.AttributeSet attrs)
public LottieAnimationView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
public void invalidateDrawable(android.graphics.drawable.Drawable dr)
protected android.os.Parcelable onSaveInstanceState()
protected void onRestoreInstanceState(android.os.Parcelable state)
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
protected boolean verifyDrawable(android.graphics.drawable.Drawable drawable)
protected void onDraw(android.graphics.Canvas canvas)
protected void onDetachedFromWindow()
public void recycleBitmaps()
public void setAnimation(java.lang.String animationName)
public void setAnimation(java.lang.String animationName,
LottieAnimationView.CacheStrategy cacheStrategy)
LottieAnimationView.CacheStrategy.Strong will hold a strong reference to the composition once it is loaded
and deserialized. LottieAnimationView.CacheStrategy.Weak will hold a weak reference to said composition.public void setAnimation(org.json.JSONObject json)
public void setComposition(LottieComposition composition)
public void addAnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener updateListener)
public void removeUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener updateListener)
public void addAnimatorListener(android.animation.Animator.AnimatorListener listener)
public void removeAnimatorListener(android.animation.Animator.AnimatorListener listener)
public void loop(boolean loop)
public boolean isAnimating()
public void playAnimation()
public void cancelAnimation()
public void pauseAnimation()
public void setProgress(float progress)
public float getProgress()
public long getDuration()