0

I want to display a site build using MDL on an Android Webview, but as soon as I enable Javascript the webview displays a blank page. This happens even using the getmdl.io template examples.

WebView myWebView = (WebView) findViewById(R.id.mainWebView);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.loadUrl("http://www.getmdl.io/templates/android-dot-com/index.html");
drcursor
  • 126
  • 1
  • 4

1 Answers1

1

If there is no width and height set for the webview, mdl's javascript is not able to correctly recognise viewport size and assumes 0. Solution is as easy as adding width and height to the webview.

drcursor
  • 126
  • 1
  • 4