Android的web视图显示空白页 [英] android webview displaying blank page

查看:217
本文介绍了Android的web视图显示空白页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我使用在Android 2.3.3运行模拟器与嵌套在的LinearLayout(垂直)一的FrameLayout一个嵌入的WebView开发Android应用程序。不管我用什么code不真正做任何事情。我有设定为互联网的android应用权限。
甚至试图加载只是HTML code时。我得到一个空白页,没有错误什么都没有。在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.

任何想法?

推荐答案

我觉得如果你修改某些code,那么这将是我ok.Look如何做到这一点在我的情况below.Try您在本方式..结果
用于显示网页

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

final WebView wbView = (WebView) findViewById(R.id.WebView);

wbView.getSettings().setJavaScriptEnabled(true); 
wbView.loadUrl("https://play.google.com/store/apps");
wbView.clearView();
wbView.measure(100, 100);
wbView.getSettings().setUseWideViewPort(true);
wbView.getSettings().setLoadWithOverviewMode(true);

有关显示HTML:结果
请参阅本教程。

For showing HTML:
See this tutorial..

  • android-tutorial-html-file-in-webview

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

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