且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

机器人的WebView性能

更新时间:2023-11-18 23:39:10

试试这个:

  mWebView.setLayerType(View.LAYER_TYPE_HARDWARE,NULL);
 

In my app, I am loading a list of external url's in webview and allow user to flip through them. Webviews are loaded on to a view flipper. I find the performance is really bad in webview load url. I have tried everything from using the frame layout to limiting the number of webviews to load. Still the performance is not satisfactory.

How do I optimize the performance of webview? This should be a common usage. Am I missing something obvious.

My Webview settings are -

    webView.setInitialScale(WEBVIEW_SCALE);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setBuiltInZoomControls(false);
    webView.setWebViewClient(new MyWebViewClient());    
    webView.setOnTouchListener( new OnTouchListener());

Try this:

mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);