android webview displaying blank page(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显示空白页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:android webview显示空白页面


- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01