Skip to content

Commit d74aab3

Browse files
rbergheggergpeal
authored andcommitted
Bugfix - Render LottieAnimationView in edit mode (airbnb#42)
* Changes the init() method of the LottieAnimationView so the animation is only set if the view is not in edit mode (e.g. layout preview). * Reverts code formatting.
1 parent 864198b commit d74aab3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lottie/src/main/java/com/airbnb/lottie/LottieAnimationView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public LottieAnimationView(Context context, AttributeSet attrs, int defStyleAttr
9090
private void init(@Nullable AttributeSet attrs) {
9191
TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.LottieAnimationView);
9292
String fileName = ta.getString(R.styleable.LottieAnimationView_lottie_fileName);
93-
if (fileName != null) {
93+
if (!isInEditMode() && fileName != null) {
9494
setAnimation(fileName);
9595
}
9696
if (ta.getBoolean(R.styleable.LottieAnimationView_lottie_autoPlay, false)) {

0 commit comments

Comments
 (0)