I'm currently playing around with the AirBnB's Lottie library for Android, and I'm having issues with LottieAnimationView
Z ordering. Regardless of whether I place the LottieAnimationView at the top of the RelativeLayout
, it always appears on top of all of the other elements in the layout, for example:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/spacing_lrg"
tools:context="com.myapp.SplashActivity">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:lottie_fileName="test.json"/>
<! -- Other Elements that should appear on top of the background animation -->
</RelativeLayout>
I've also tried setting the LottieAnimationView
's elevation to 0, but with no success at fixing the issue. Does anyone have an idea of how to fix this, or if it's just a limitation of the library? Also, if it's a limitation, what causes it?
It's possible this has been fixed in a library update, as this problem occurred with a very early version of the library.
In the example application, you can swipe left or right and the Mario animation will speed up or play in reverse. If you play it backwards to the beginning then it will start again at normal speed.
Lottie is a library for Android, iOS, Web, and Windows that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile and on the web! The above animation was created in After Effects, and can be rendered natively across all platforms with a simple json file.
I can't reproduce the problem you are referring to in any layout including RelativeLayout. Maybe upgrading to the latest version fixes the problem. The latest version is 3.4.1: implementation 'com.airbnb.android:lottie:3.4.1'
. If you've been already using the latest version, please share your complete code so we can investigate further.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With