Explorar el Código

remove webview when onDestroy

hanjing hace 6 años
padre
commit
767e4d2cde

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/module/webview/fragment/FgtWeb.java

@@ -13,6 +13,7 @@ import android.support.v7.app.AlertDialog;
 import android.text.TextUtils;
 import android.view.MotionEvent;
 import android.view.View;
+import android.view.ViewGroup;
 import android.view.animation.Animation;
 import android.view.animation.AnimationUtils;
 import android.webkit.CookieManager;
@@ -211,6 +212,9 @@ public class FgtWeb extends BaseFgtWeb {
             }
         }
         if (mWebView != null) {
+            if (mWebView.getParent() != null) {
+                ((ViewGroup) mWebView.getParent()).removeView(mWebView);
+            }
             mWebView.setVisibility(View.GONE);
             mWebView.removeAllViews();
             mWebView.destroy();

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/module/webview/fragment/FgtWebX5.java

@@ -14,6 +14,7 @@ import android.text.TextUtils;
 import android.util.Log;
 import android.view.MotionEvent;
 import android.view.View;
+import android.view.ViewGroup;
 import android.view.animation.Animation;
 import android.view.animation.AnimationUtils;
 import android.widget.ImageView;
@@ -200,6 +201,9 @@ public class FgtWebX5 extends BaseFgtWebX5 {
             }
         }
         if (mWebView != null) {
+            if (mWebView.getParent() != null) {
+                ((ViewGroup) mWebView.getParent()).removeView(mWebView);
+            }
             mWebView.setVisibility(View.GONE);
             mWebView.removeAllViews();
             mWebView.destroy();