Android WebView Not Loading Mobile Site

前端 未结 5 1912
长情又很酷
长情又很酷 2021-01-07 05:39

My app shows a list of articles from an RSS feed and when one is selected it shows the article in a web view. The problem is that the web view is displaying the desktop sit

5条回答
  •  悲哀的现实
    2021-01-07 06:23

      WebSettings settings = view.getSettings();
          settings.setJavaScriptCanOpenWindowsAutomatically(true);
          settings.setSupportMultipleWindows(true);
          settings.setBuiltInZoomControls(true);
          settings.setJavaScriptEnabled(true);
          settings.setAppCacheEnabled(true);
          settings.setAppCacheMaxSize(10 * 1024 * 1024);
          settings.setAppCachePath("");
          settings.setDatabaseEnabled(true);
          settings.setDomStorageEnabled(true);
          settings.setGeolocationEnabled(true);
          settings.setSaveFormData(false);
          settings.setSavePassword(false);
          settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
          // Flash settings
          settings.setPluginState(WebSettings.PluginState.ON);
    
          // Geo location settings
          settings.setGeolocationEnabled(true);
          settings.setGeolocationDatabasePath("/data/data/selendroid");
        } catch (Exception e) {
          SelendroidLogger.error("Error configuring web view", e);
        }
    

提交回复
热议问题