【问题标题】:Can I Add GIF format Image as a Splash Screen我可以添加 GIF 格式的图像作为启动画面吗
【发布时间】:2017-02-13 17:56:13
【问题描述】:

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

【问题讨论】:

  • 试试这个stackoverflow.com/questions/6533942/…>.

标签: android android-studio imageview gif splash-screen


【解决方案1】:

是的,您可以为启动画面添加 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

或者

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

【讨论】:

  • @chandra 很高兴知道这一点。
  • 对于那些想知道的人:您不需要将 gif 文件转换为另一种格式。只需使用可绘制或 mipmap 资源文件夹中的图像文件即可。效果很好!
  • 抱歉,具体是哪个 XML 文件?
【解决方案2】:

使用 glide 来解决这个问题。

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

转到thisstackoverflow 链接了解更多详情

【讨论】:

    猜你喜欢
    • 2021-10-28
    • 2014-01-02
    • 2017-09-26
    • 2011-11-25
    • 2015-04-21
    • 2014-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多