簡體   English   中英

如何從 glide v4.11.0 中的 drawable 加載 gif(asGif() 方法未解析)

[英]How to load gif from the drawable in glide v4.11.0 (asGif() method is not resolved)

我需要從圖像視圖中的 drwable 文件夾加載 Gif。 我如何在 glide 4.11.0 版本中顯示這個?

另外,請注意 asGif 方法無法解析。

Glide
   .with(this)
   .load(R.drawable.run).asGif()
   .into(mGifImage);
Glide
   .with(this)
   .asGif()
   .load(R.drawable.run).asGif()
   .into(mGifImage);

如果 asGIF() 不起作用,那么

使用這個庫GIFPLAYER

使用下面的工作

Glide.with(itemView.getContext())
    .asGif()
    .load(thumbPath)                             
    .placeholder(ResourcesCompat.getDrawable(context.getResources(), 
                     R.drawable.image_loading_placeholder, null))
    .centerCrop()
    .into(new ImageViewTarget<GifDrawable>(imageView) {
         @Override
         protected void setResource(@Nullable GifDrawable resource) {
             imageView.setImageDrawable(resource);
         }
     });

暫無
暫無

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

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