Andoid:popwindow里嵌入webview使用报错解决方案:d.view.WindowManager$BadTokenException: Unable to add window -- t
来源:互联网 发布:java图形界面建类设计 编辑:程序博客网 时间:2024/05/16 19:13
错误背景:
最近闲的没事,将webview添加在popwindow里使用,配合同事写html5的JS做测试,结果等webview里的url加载后,我需要去touch里面的内容,就会报以下的错误:
11-14 18:06:01.597: WARN/KeyCharacterMap(10459): No keyboard for id 65541
11-14 18:06:01.597: WARN/KeyCharacterMap(10459): Using default keymap: /system/usr/keychars/qwerty.kcm.bin11-14 18:06:04.295: WARN/WindowManager(99): Attempted to add window with token that is a sub-window: android.os.BinderProxy@44eb14b8. Aborting.
11-14 18:06:04.305: WARN/dalvikvm(10459): threadid=1: thread exiting with uncaught exception (group=0x40028a00)
11-14 18:06:04.305: ERROR/AndroidRuntime(10459): FATAL EXCEPTION: main
11-14 18:06:04.305: ERROR/AndroidRuntime(10459): android.view.WindowManager$BadTokenException: Unable to add window -- token android.view.ViewRoot$W@44cbdcb0 is not valid; is your activity running?
11-14 18:06:04.305: ERROR/AndroidRuntime(10459): at android.view.ViewRoot.setView(ViewRoot.java:509)
最终发现mWebView.getSettings().setBuiltInZoomControls(true);不能设置,下面看代码
LayoutInflater mLayoutInflater = (LayoutInflater)cxt. getSystemService(cxt.LAYOUT_INFLATER_SERVICE);
menuView = (ViewGroup) mLayoutInflater.inflate(
R.layout.gridview_pop, null, true);
mWebView=(WebView) menuView.findViewById(R.id.gridview_webview);
WebSettings webSettings = mWebView.getSettings();
webSettings.setSavePassword(false);
webSettings.setSaveFormData(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(true);
webSettings.setUseWideViewPort(true);
mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setHorizontalScrollBarEnabled(false);
mWebView.getSettings().setSupportZoom(true);
//============================配合popwindow一定不能使用下面开关,否则就汇报
//mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.setInitialScale(70);
mWebView.setHorizontalScrollbarOverlay(true);
mWebView.setWebChromeClient(new AdViewWebChromeClient(this));
mWebView.setWebViewClient(new AdViewWebClient(this));
mWebView.loadUrl("http://www.souapp.com");
POPWINDOW里嵌入的webview图例:
- Andoid:popwindow里嵌入webview使用报错解决方案:d.view.WindowManager$BadTokenException: Unable to add window -- t
- android.view.WindowManager$BadTokenException: Unable to add window报错
- Android报错android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for
- android.view.WindowManager$BadTokenException: Unable to add window
- android.view.WindowManager$BadTokenException: Unable to add window
- android.view.WindowManager$BadTokenException: Unable to add window
- android.view.WindowManager$BadTokenException: Unable to add window -- token nul
- 异常android.view.WindowManager$BadTokenException: Unable to add window解决方法
- android.view.WindowManager$BadTokenException: Unable to add window
- android.view.WindowManager$BadTokenException: Unable to add window异常
- android.view.WindowManager$BadTokenException: Unable to add window -- token
- android.view.WindowManager$BadTokenException: Unable to add window
- android.view.WindowManager$BadTokenException: Unable to add window(转)
- 【已解决】android.view.WindowManager$BadTokenException: Unable to add window
- 解决android.view.WindowManager$BadTokenException: Unable to add window -- token .
- android.view.WindowManager$BadTokenException: Unable to add window
- android.view.WindowManager$BadTokenException: Unable to add window
- android.view.WindowManager$BadTokenException: Unable to add window
- 如何设置RichView导出Html页面的页眉页脚
- HTML解析工具(java版)
- surfaceDestroyed什么时候被调用
- HTML_TABLE内外边框颜色设置及页面居中
- linux CentOS 5 安装 apt-get
- Andoid:popwindow里嵌入webview使用报错解决方案:d.view.WindowManager$BadTokenException: Unable to add window -- t
- RichView12.74FullSource 下载
- Windows Mobile窗口全屏总结
- 工作手记(一)
- 利用命名管道实现进程之间的通信 .........
- Java WEB——国际化
- 我的UBUNTU 11.10屏幕分辨率问题解决
- 可以参考的vim配置(主要是插件)
- YAFSS移植