Gif not animated in custom listview

前端 未结 5 576
南方客
南方客 2021-02-02 03:51

\"enter

I want to display animated GIF images in my custom listview.my GIF image is get in

相关标签:
5条回答
  • 2021-02-02 04:31

    You can use Android Movie class that is able to decode gifs.

    Movie.decodeStream(InputStream is);
    
    0 讨论(0)
  • 2021-02-02 04:32

    Use WebView rather then ImageView and loadUrl in WebView.

    0 讨论(0)
  • 2021-02-02 04:42

    you have to use gif decorder class for that and set it in inflact view so you can set two view in single activity or screen.

    0 讨论(0)
  • 2021-02-02 04:45
    //-----------------GIF Image view ------------
    
    holder.imgAdd.getSettings().setJavaScriptEnabled(true);
    
    holder.imgAdd.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress)
        {
            activity.setTitle("Loading...");
            activity.setProgress(progress * 100);
    
            if(progress == 100)
                activity.setTitle(R.string.app_name);
        }
    });
    
    holder.imgAdd.setWebViewClient(new WebViewClient() {
        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
        {
            // Handle the error
        }
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url)
        {
            view.loadUrl(url);
            return true;
        }
    });
    
                holder.imgAdd.loadUrl(imgUrl);
    
    0 讨论(0)
  • 2021-02-02 04:48

    Use the Glide image loading library, it has built-in support for GIFs and the syntax is the same loading a JPEG file:

    Glide.with(this).load("http://.../anim.gif").into(imageView);
    

    See the wiki for more and run the Gihpy sample to be amazed :)

    0 讨论(0)
提交回复
热议问题