Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中显示带有点击功能的动画gif图像?_Android_Webview_Animated Gif - Fatal编程技术网

如何在android中显示带有点击功能的动画gif图像?

如何在android中显示带有点击功能的动画gif图像?,android,webview,animated-gif,Android,Webview,Animated Gif,是否有任何方法可以在任何控件中显示动画gif图像,该控件还应显示正常的jpg、png格式,即我将从服务器获得的图像源 我已经尝试使用Webview,但我有一个滚动的问题,图像应该适合控件的大小,而且它应该接受点击功能 我的webview代码: 网络视图类: public class GIFView extends WebView { public static final String HTML_FORMAT = "<html><body style=\"text-align:

是否有任何方法可以在任何控件中显示动画gif图像,该控件还应显示正常的jpg、png格式,即我将从服务器获得的图像源

我已经尝试使用Webview,但我有一个滚动的问题,图像应该适合控件的大小,而且它应该接受点击功能

我的webview代码:

网络视图类:

public class GIFView extends WebView {
public static final String HTML_FORMAT = "<html><body style=\"text-align: center;  vertical-align: right;background-color: transparent;\"><img src = \"%s\" /></body></html>";
public GIFView(Context context, String fileUrl) throws IOException {
    super(context);
    final String html = String.format(HTML_FORMAT, fileUrl);
    setBackgroundColor(Color.TRANSPARENT);
    loadDataWithBaseURL("", html, "text/html", "UTF-8", "");
   }
}
LinearLayout llProgress = (LinearLayout) findViewById(R.id.ll_progress);
    GIFView gif = null;
    try {
        gif = new GIFView(this, "file:///android_asset/giphy.gif");
        llProgress.addView(gif);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

有谁能帮我摆脱这个问题吗,请提前谢谢

五月helpful@Krrish,有许多与此主题相关的问题,请尝试从中找到解决方案,而不是再次发布相同的问题。请参阅:我使用Glide库实现了这一点。如需进一步参考,请查看此链接