2021年3月28日星期日

Android webview scroll speed gets occasionally fast

While building a SNS hybrid application, I noticed that the webview gets scrolled nearly twice the distance than the actual gesture distance. This does not happen always, but I could not figure out the condition for this issue. The content of the webview gets extended as I scroll down, so I am suspecting that it is happening when I interact with the webview while the webview itself is loading and the content of the webview is getting extended. The below is the settings of my webview.

ps. once this issue occurs, it does not go away even if you navigate to another page.

    iWebViewClient = new IWebViewClient(onActivity);      iWebChromeClient = new IWebChromeClient(onActivity, mContainer, webView, pbar);      webView.setWebViewClient(iWebViewClient);      webView.setWebChromeClient(iWebChromeClient);      webView.setVerticalScrollBarEnabled(false);        // javascript interface      webView.addJavascriptInterface(new WebViewInterface(onActivity), "ApplicationInterface");        WebSettings webSettings = webView.getSettings();        // enable javascript and storage      webSettings.setJavaScriptEnabled(true);      webSettings.setDomStorageEnabled(true);      webSettings.setAllowFileAccess(true);      webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // allow new window to open      webSettings.setSupportMultipleWindows(true);      webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);        // enable css      WebView.setWebContentsDebuggingEnabled(true);      webSettings.setUseWideViewPort(true);      webSettings.setLoadWithOverviewMode(true);        // disable cache      webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);        // set useragent      String device = "Android " + Build.VERSION.RELEASE;      String appVersion = " " + BuildConfig.APPLICATION_ID + "/" + BuildConfig.VERSION_NAME;      String agentNew = webSettings.getUserAgentString() + appVersion + " (" + device + ")";      webSettings.setUserAgentString(agentNew);        if(initUrl != null){          webView.loadUrl(initUrl);      }else{          webView.loadUrl(HostUrls.webSite);      }  
https://stackoverflow.com/questions/66847914/android-webview-scroll-speed-gets-occasionally-fast March 29, 2021 at 10:02AM

没有评论:

发表评论