android webview显示空白页面

我有一个 android 应用程序,我正在使用在 android 2.3.3 上运行的模拟器进行开发,其中嵌入的 WebView 在嵌套在线性布局(垂直)中的框架布局中.无论我使用什么代码,它实际上都不会做任何事情.我将 android 应用程序的权限设置为 INTERNET.即使尝试仅加载 HTML 代码.我得到一个空白的白页,没有错误,什么都没有.logcat 中也没有任何内容.

I have an android application that I am developing using the emulator running on android 2.3.3 with an embedded WebView in a framelayout nested in a linearlayout (vertical). No matter what code I use it never actually does anything. I have Permissions on the android application set to INTERNET. Even when trying to load just the HTML code. I get a blank white page, no errors no nothing. Nothing in logcat as well.

WebView wview = (WebView)findViewById(R.id.webView1);
wview.getSettings().setJavaScriptEnabled(true);

我已经尝试了所有这三种方法来尝试将任何内容加载到 webview 中:

I have tried all three of these to attempt to load anything into the webview:

wview.loadUrl("http://www.google.com");
wview.loadData("<HTML><BODY><H3>Test</H3></BODY></HTML>","text/html","utf-8");
wview.loadDataWithBaseURL(null, "<HTML><BODY><H3>Test</H3></BODY></HTML>","text/html","utf-8",null);

这三个都给了我相同的结果.什么都没有.

All three give me the same results. Nothing.

有什么想法吗?

推荐答案

WebSettings settings = wbView.getSettings();
settings.setDomStorageEnabled(true);

相关文章