如何提高的WebView加载时间加载、时间、WebView

2023-09-06 01:51:12 作者:熊熊不见辣

我有我可以的WebView加载一个URL。如果我通过浏览器中打开的WebView它需要较少的时间,但如果我的WebView加载的URL需要更多的时间。另外,如果我必须用相同的URL在另一个屏幕,然后我不能这样做,因为,如果我用同样的WebView对象在不同的​​屏幕上随后还需要时间来加载的URL重复使用相同的WebView页面。

如何让我的web视图立即加载一个网址?

解决方案   

在默认情况下,一个web视图不提供类似浏览器的窗口小部件,不   启用JavaScript和网页错误被忽略。

在这里,我贴$ C $的 zirco浏览器

settings.setJavaScriptEnabled(Controller.getInstance().get$p$pferences().getBoolean(Constants.$p$pFERENCES_BROWSER_ENABLE_JAVASCRIPT,真正));             settings.setLoadsImagesAutomatically(Controller.getInstance().get$p$pferences().getBoolean(Constants.$p$pFERENCES_BROWSER_ENABLE_IMAGES,真正));             settings.setUseWideViewPort(Controller.getInstance().get$p$pferences().getBoolean(Constants.$p$pFERENCES_BROWSER_USE_WIDE_VIEWPORT,真正));             settings.setLoadWithOverviewMode(Controller.getInstance().get$p$pferences().getBoolean(Constants.$p$pFERENCES_BROWSER_LOAD_WITH_OVERVIEW,假));             settings.setSaveFormData(Controller.getInstance().get$p$pferences().getBoolean(Constants.$p$pFERENCES_BROWSER_ENABLE_FORM_DATA,真正));             settings.setSavePassword(Controller.getInstance().get$p$pferences().getBoolean(Constants.$p$pFERENCES_BROWSER_ENABLE_PASSWORDS,真正));             settings.setDefaultZoom(ZoomDensity.valueOf(Controller.getInstance().get$p$pferences().getString(Constants.$p$pFERENCES_DEFAULT_ZOOM_LEVEL, ZoomDensity.MEDIUM.toString())));             settings.setUserAgentString(Controller.getInstance().get$p$pferences().getString(Constants.$p$pFERENCES_BROWSER_USER_AGENT, Constants.USER_AGENT_DEFAULT));

I have a URL which I can load in webview. If I open the webview through browser it takes less time, but if I load the URL in webview it takes more time. Also if I have to reuse the same webview page with the same URL in another screen then I am unable to do that because if I use the same webview object in different screens then also it takes time to load the URL.

我在登录CF的时候突然消失到底是怎么回事 就是在加载的时候加载到了百分之56的时候突然消失了

How do I make my webview to load a URL instantly?

解决方案

By default, a WebView provides no browser-like widgets, does not enable JavaScript and web page errors are ignored.

here i paste small part of code of zirco-browser

settings.setJavaScriptEnabled(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_ENABLE_JAVASCRIPT, true));
            settings.setLoadsImagesAutomatically(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_ENABLE_IMAGES, true));
            settings.setUseWideViewPort(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_USE_WIDE_VIEWPORT, true));
            settings.setLoadWithOverviewMode(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_LOAD_WITH_OVERVIEW, false));
            settings.setSaveFormData(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_ENABLE_FORM_DATA, true));
            settings.setSavePassword(Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_BROWSER_ENABLE_PASSWORDS, true));
            settings.setDefaultZoom(ZoomDensity.valueOf(Controller.getInstance().getPreferences().getString(Constants.PREFERENCES_DEFAULT_ZOOM_LEVEL, ZoomDensity.MEDIUM.toString())));             
            settings.setUserAgentString(Controller.getInstance().getPreferences().getString(Constants.PREFERENCES_BROWSER_USER_AGENT, Constants.USER_AGENT_DEFAULT));