Android Webview Displaying Blank Page
Solution 1:
WebSettingssettings= wbView.getSettings();
settings.setDomStorageEnabled(true);
Solution 2:
It might be a bit too late, but I wanted to share my experience with you, because I had the same problem and spent a lot of time on it.
Put your WebView
in RelativeLayout
and not in FrameLayout
.
What I have tested: My WebView
's onPageFinished()
was called every time, but on the screen I got blank page.
From chrome://inspect
WebView
debugger I was able to "ping" my WebView
by pressing inspect
button, and after that WebView
was refreshing immediately.
My thoughts - WebView
isn't rendered correctly in FrameLayout
, and RelativeLayout
fixes the issue (even invalidate()
and requestLayout()
calls didn't help).
Solution 3:
I think if you edit some of your code then it will be ok.Look how i do it in my case below.Try for you in this way.. For displaying a web page
finalWebViewwbView= (WebView) findViewById(R.id.WebView);
WebSettingssettings= wbView.getSettings();
settings.setJavaScriptEnabled(true);
wbView.loadUrl("https://play.google.com/store/apps");
wbView.clearView();
wbView.measure(100, 100);
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
For showing HTML: See this tutorial..
Solution 4:
instead of passing null, you should pass an empty String
to it. ex: ""
So you should call it like this:
wview.loadDataWithBaseURL("", "<HTML><BODY><H3>Test</H3></BODY></HTML>","text/html","utf-8","");
Solution 5:
I gave +1 because these were both valid assistance to getting the webview to working properly, but it was not the solution to my issue.
What I didn't realize is I had a wrap_content on the include of my webview layout and this caused it to have a height of 0px. By setting this to fill_parent I resolved the issue. (Webview with white background and app with white background you cant really tell its not full height when it shows up as full height in the layout designer.)
Thanks for your help though!
Post a Comment for "Android Webview Displaying Blank Page"