2017-10-11 79 views
0

我目前正在玩Android版AirBnB的Lottie library,我遇到LottieAnimationView Z訂購問題。不管我是否放置LottieAnimationView在RelativeLayout的頂部,它總是出現在所有佈局前的其他元素的頂部:Lottie動畫庫Z訂購問題

<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> 

我也嘗試設置LottieAnimationView的海拔爲0 ,但在解決問題方面沒有成功。有沒有人有如何解決這個問題的想法,或者如果它只是圖書館的限制?另外,如果是限制,是什麼原因造成的?

回答

0

嘗試通過代碼加載lottie文件名。當我通過xml加載文件時遇到了一些問題

您可以爲其他視圖使用一個Linear並調用linearlayout.bringToFront()