android webView加载gif图片并且居中显示
2013-09-06 10:14
711 查看
开源的gifView在我使用的时候 内存不释放,容易引起内存泄露,最后不得不使用webView
gif图片放到asset文件夹下边,
WebViewgf1=(WebView) findViewById(R.id.gif1);
gf1.loadDataWithBaseURL(null,"<center><imgsrc='file:///android_asset/gif2.gif'></center>","text/html","utf-8", null);
webView在RelativeLayout中居中显示,如果RelativeLayout设置android:gravity="center" 仍然没有效果,在webView中设置
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
ondestory()方法里边
gf1.loadUrl("about:blank");
gf1.stopLoading();
gf1= null;
回收
gif图片放到asset文件夹下边,
WebViewgf1=(WebView) findViewById(R.id.gif1);
gf1.loadDataWithBaseURL(null,"<center><imgsrc='file:///android_asset/gif2.gif'></center>","text/html","utf-8", null);
webView在RelativeLayout中居中显示,如果RelativeLayout设置android:gravity="center" 仍然没有效果,在webView中设置
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
ondestory()方法里边
gf1.loadUrl("about:blank");
gf1.stopLoading();
gf1= null;
回收
相关文章推荐
- android中WebView加载网页居中显示
- Android TextView加载HTMl图文之让图片居中显示
- android https加载WebView图片不显示问题
- android中WebView加载网页居中显示
- Android WebView加载网页不显示图片解决办法
- Android中图片的展示之Webview居中显示图片
- 安卓 WebView加载本地图片时居中显示
- android中WebView加载网页居中显示
- Android下webview加载网页失败后显示一张平铺图片
- android webview 加载图片一直显示正在加载中
- Android开发问题积累 <加载在线Gif><WebView无法加载网页图片>
- Android 5.0中使用webView 加载网页不显示图片问题
- Android 5.0中使用webView 加载网页不显示图片问题
- Android webview加载https网页时图片无法加载显示问题
- Android开发问题积累 <加载在线Gif><WebView无法加载网页图片>
- Android webview加载https网页时http图片无法显示
- Webview--如何让加载进来的页面自适应手机屏幕分辨率居中显示
- Android开发模板------WebView加载时显示ProgressBar进度条
- webView加载 https 的网页,不显示图片.md
- Android WebView先加载网页文字,后加载图片