我可以添加 GIF 格式图像作为启动画面吗

Can I Add GIF format Image as a Splash Screen

如何将 GIF 格式图像添加为初始屏幕。我试图添加但是当我添加它时。它充当普通图像。我不知道我们是否可以使用 Gif 图片作为启动画面。如果有任何选项可以处理该 GIF 格式图像。

是的,您可以为启动画面添加 Gif 图像。在您的视图中使用 Gif 图像。

将此依赖项添加到应用模块中的 build.gradle 文件。

求最新版本。

dependencies {
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'
}

并在 XML 文件中以这种方式添加

<pl.droidsonroids.gif.GifTextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/yourgif_image"
    />

并将您的 Gif 图片添加到 Drawable。

有关更多详细信息,请访问:https://github.com/koral--/android-gif-drawable

您可以为图像创建不同的帧,并在很短的时间内一个接一个地添加它。

使用滑行来解决这个问题。

ImageView imageView = findViewById(R.id.splashScreen);
        GlideDrawableImageViewTarget splashScreen = new GlideDrawableImageViewTarget(imageView);
        Glide.with(this).load(R.raw.gif_men_at_work).into(splashScreen);

转到 this Whosebug link 了解更多详细信息