Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lottie Animation Library Z Ordering Issue

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.

like image 600
Submersed Avatar asked Oct 11 '17 17:10

Submersed


People also ask

How can I increase my Lottie animation speed?

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.

Do Lottie animations work on mobile?

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.


1 Answers

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.

like image 134
Sina Avatar answered Oct 06 '22 23:10

Sina