开源的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;
回收