如何在Android中更改LottieAnimationView的背景颜色

问题描述 投票:0回答:1

我在我的 andriod XML 中使用了 LottieAnimationView 和 Lottie 动画文件。动画文件本身具有透明背景,但 LottieAnimationView 有白色背景,我似乎无法更改。

当我进入深色模式时,LottieAnimationView 的白色背景可见。

enter image description here

我尝试更改 XML 中的背景标签,但没有效果。这里是 XML:

<com.airbnb.lottie.LottieAnimationView
                    android:id="@+id/anim_start_btn"
                    android:layout_width="@dimen/_110sdp"
                    android:layout_height="@dimen/_40sdp"
                    android:background="@color/background"
                    android:backgroundTint="@color/background"
                    android:scaleType="centerCrop"
                    app:lottie_speed="1.2"
                    app:lottie_rawRes="@raw/start_btn"
                    app:lottie_autoPlay="false"
                    app:lottie_loop="false"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintBottom_toTopOf="@id/tv_start_instruction"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    />
android android-layout lottie android-lottie
1个回答
0
投票

根据lottie-android的贡献者的说法,“Lottie没有背景的概念”

由于该评论是大约两年前的,我不确定它是否仍然有效,但最好仔细检查一下您的动画是否真的没有白色背景,并且 XML 中的父视图没有白色背景。

© www.soinside.com 2019 - 2024. All rights reserved.