bug 信息如图:
搜索 ZoomButtonsController 之后几乎所有的问题都指向: WebView
看下 WebActivity,这个版本为了兼容合作公司的网页,加了一堆配置
webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webview.getSettings().setAllowFileAccess(true);
webview.getSettings().setSupportZoom(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setSupportMultipleWindows(true);
webview.getSettings().setAppCacheEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setGeolocationEnabled(true);
webview.getSettings().setAppCacheMaxSize(Long.MAX_VALUE);
webview.getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
问题应该就出在这里,按照这篇文章中的说法:
webview ZoomButtonsController 调用崩溃问题android.widget.ZoomButtonsController,在调用 webView.destroy() 之前,应该先调用: webview.setVisibility(View.GONE) ,不过之后在这篇文章中又提到部分手机不兼容的问题,那么,事实上原生 WebView 的 ZoomButton 巨丑,商量之后,果断禁用掉,还省去了一堆麻烦事:
webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webview.getSettings().setAllowFileAccess(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setSupportMultipleWindows(true);
webview.getSettings().setAppCacheEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setGeolocationEnabled(true);
webview.getSettings().setAppCacheMaxSize(Long.MAX_VALUE);
webview.getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webview.getSettings().setBuiltInZoomControls(false);
webview.getSettings().setSupportZoom(flase);
本文探讨了WebView组件中ZoomButtonsController导致的应用崩溃问题,并提供了解决方案。通过禁用内置缩放控件并调整WebSettings设置来避免崩溃,同时确保了应用的稳定性和兼容性。
4468

被折叠的 条评论
为什么被折叠?



