ZoomButtonsController未附加到窗口管理器

时间:2015-12-02 06:48:51

标签: android

我使用了webView,并使用了

        webSettings.setBuiltInZoomControls(true);
        webSettings.setDisplayZoomControls(false);

但它导致了崩溃:

java.lang.IllegalArgumentException: View=android.widget.ZoomButtonsController$Container{3985b03a V.E..... ......I. 0,0-1080,146} not attached to window manager
at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:402)
at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:328)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)
at android.widget.ZoomButtonsController.setVisible(ZoomButtonsController.java:406)
at android.widget.ZoomButtonsController$2.handleMessage(ZoomButtonsController.java:178)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

我的onDestroy()方法是:

        if (null != mGraphicDetailWv) {
        mGraphicDetailSv.removeView(mGraphicDetailWv);
        mGraphicDetailWv.removeAllViews();
        mGraphicDetailWv.clearHistory();
        mGraphicDetailWv.destroy();
        mGraphicDetailWv = null;
    }

我不知道这次事故是怎么发生的。谢谢你回答。

1 个答案:

答案 0 :(得分:0)

mGraphicDetailWv.setVisibility(View.GONE)之前致电mGraphicDetailWv.destroy()

这对于低于23的操作系统应该是一个问题