Nexus 4, Galaxy Nexus 및 Nexus 7과 같은 Nexus 기기에서이 이상한 문제가 발생했습니다. 웹보기가있는 탭이 여러 개인 앱과 같은 브라우저가 있습니다.자바 스크립트를 사용 설정하면 Android Webview의 Nexus 기기 속도가 느려짐
여러 개의 탭 (2 개 이상)으로 Google.com과 같은 사이트를 열면 웹보기에 클릭이 발생하지 않습니다. 또한 웹 사이트로드가 꽤 느립니다. 다음 내가 자바 스크립트가 '거짓'모든 webviews가 원활하게 작동에 사용할 설정하면 내 웹보기가
private void doWebSettings(WebView webview) {
webview.setScrollbarFadingEnabled(true);
webview.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
// enable smooth transition for better performance during panning or
// zooming
if (currentSdk >= OS_3_0) {
webSettings.setEnableSmoothTransition(true);
}
// For Zooming out completely
webSettings.setLoadWithOverviewMode(true);
webSettings.setUseWideViewPort(true);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAllowFileAccess(true);
try {
webSettings.setAllowContentAccess(false);
} catch (NoSuchMethodError e) {
e.printStackTrace();
}
String databasePath = this.getApplicationContext()
.getDir("database", Context.MODE_PRIVATE).getPath();
webSettings.setDatabasePath(databasePath);
webSettings.setGeolocationDatabasePath(this.getApplicationContext()
.getDir("geolocation", 0).getPath());
webSettings.setRenderPriority(RenderPriority.HIGH);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
webSettings.setDatabaseEnabled(true);
// Dont focus on any webview item by default
webSettings.setNeedInitialFocus(false);
if (!isTablet) {
webSettings
.setUserAgentString("Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
}
}
을 설정입니다. 이 문제는 모든 넥서스 장치에서 두드러지게 관찰됩니다. 때로는 웹 뷰가 몇 분 동안 클릭을받지 않는 경우가 있습니다. 이 동작으로 인해 앱을 사용할 수 없게됩니다. 나는 일부 JavaScript가 Webview 용 UI 쓰레드를 소비하고 있다고 추측하고있다. Eclipse에서 setJavascriptEnabled (true)에 대한 경고를받습니다. "으로 설정하십시오. setJavaScriptEnabled를 사용하면 응용 프로그램에 XSS 취약점을 도입 할 수 있으므로 신중하게을 검토하십시오." 인터넷에서이 경고를 검색했지만 dint는 관련 답변을 찾습니다. 또한 Jellybean에서 Webview 성능 문제를 겪고있는 사람들과 관련된 게시물을 확인했습니다. 내가 여기서 무엇을 놓치고 있니?