原生Android启动画面中的Lottie动画 [英] Lottie Animation in Native Android Splash Screen

查看:104
本文介绍了原生Android启动画面中的Lottie动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在启动屏幕的布局中加载Lottie动画?

Is it possible to load a Lottie animation in the layout of my splash screen?

目前,我的初始屏幕布局如下:

Currently my splash screen layout is as such:

background.xml

background.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">

<item android:drawable="@drawable/path_background_gradient" />

<item
    android:drawable="@drawable/ic_locky"
    android:gravity="center" />

</layer-list>

styles.xml

styles.xml

<!-- Splash Launcher UI theme. -->
<style name="Locky.Theme.Launcher" parent="Locky.Theme">
    <item name="android:windowBackground">@drawable/custom_background_launcher</item>
    <item name="colorPrimary">@color/background_gradient_accent_start</item>
    <item name="colorPrimaryDark">@color/background_gradient_accent_start</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

我用它来防止android冷启动时出现白屏.

I used this to prevent the white screen on android cold boot.

但是我要使用Lottie动画代替图标ic_locky.有可能这样做吗?因为有许多应用程序在初始屏幕中使用动画徽标.

But instead of the icon ic_locky i want to use a Lottie animation. Is it possible to do so? Because there are many apps that uses an animated logo in the splash screen.

请帮助我.

谢谢大家.

推荐答案

@Mervin Hemaraju ...

@Mervin Hemaraju ...

我认为您可以这样做,但是不要使用可绘制对象,而应将自定义布局/活动用于启动屏幕.

I think you ca do so, but, instead of using a drawable, use a custom layout / activity for the splash screen.

(1)详细阅读: https://android.jlelse.eu/the-complete- android-splash-screen-guide-c7db82bce565

(2)选中相关部分使用具有专用启动活动的启动器主题

最好的问候,

这篇关于原生Android启动画面中的Lottie动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆