簡體   English   中英

GIF 圖像在我的應用程序中不起作用

[英]GIF image is not working in my application

Gif 不適用於我的庫:

implementation 'com.github.Cutta:GifView:1.1'

repositories {
maven {
    url "https://jitpack.io"
}

我的布局

 <com.cunoraz.gifview.library.GifView
    android:id="@+id/gif1"
    android:layout_width="212dp"
    android:layout_height="132dp"
    app:gif="@drawable/tst1" />

我的 apk 停止並沒有顯示任何內容。

試試這個解決方案:

在你的gradle中添加

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.5'

在您的布局中添加

<pl.droidsonroids.gif.GifImageView
    android:id="@+id/gif"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/abc_list_selector_holo_dark"
    />

最后,在您的活動中添加

import pl.droidsonroids.gif.GifImageView;
...

GifImageView gifImageView = (GifImageView) findViewById(R.id.gif);
gifImageView.setImageResource(R.drawable.giphy);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM