我想在服务器到图像视图中显示gif图像。 我的图像是动画(gif)只是动画(gif图像)
我的代码是:
ImageViewimgView =(ImageView)findViewById(R.id.image01);
Drawable drawable = LoadImageFromWebOperations("http://www.dariran.com/Ads/Mobile/1.gif");
imgView.setBackgroundDrawable(drawable);
private Drawable LoadImageFromWebOperations(String url) {
try {
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
}
catch (Exception e) {
System.out.println("Exc="+e);
return null;
}
}
答案 0 :(得分:0)
播放gif的最简单方法是WebView。请参阅:https://stackoverflow.com/a/12839918/3864698
实际上你也可以在CustomView中播放。