小编use*_*075的帖子

Lottie 动画全闪屏不全屏

我必须在 Android 中使用 Lottie 动画作为闪屏。我使用了匹配父级的宽度和高度。但它向我展示了屏幕边缘的一些填充,如附图所示。如果我使用scaletype作为fitXY,那么它的图像会在某些设备上拉伸。我如何为所有设备分辨率使用lottie动画文件,或者我是否需要要求我们的设计师更改文件?

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:background="@color/retention_bg_welcome_color">

<com.airbnb.lottie.LottieAnimationView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:lottie_autoPlay="true"
    app:lottie_fileName="test_lottie.json"
    android:adjustViewBounds="true"
    app:lottie_loop="true"
    app:lottie_speed="0.8" />
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

android android-animation android-layout lottie

7
推荐指数
2
解决办法
7863
查看次数