android webview显示空白页面 [英] android webview displaying blank page

查看:50
本文介绍了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);

这篇关于android webview显示空白页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆