Android的 - 的WebView =不可用网页 [英] Android - WebView = Web page not available
本文介绍了Android的 - 的WebView =不可用网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用的WebView
查看我的应用程序,无论是什么页我强迫它来参观,它说没找到的网页。这是我的code:
When using a WebView
view in my app, no matter what page I force it to visit, it says Web page not found. Here is my code:
MainActivity.java
package com.testing.webview;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class MainActivity extends Activity
{
@Override
public void onCreate( Bundle savedInstanceState )
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView webView = (WebView) findViewById(R.id.webView1);
WebSettings webSettings = webView.getSettings();
webSettings.setBuiltInZoomControls(true);
webView.loadUrl("http://www.google.com");
}
}
的main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
这是很基本的code,你可以看到。的确有互联网连接,我可以开普通的浏览器应用程序,并访问任何网页正常人一样。
It's very basic code as you can see. There is indeed an internet connection as I can open the normal Browser app and visit any webpage like normal.
推荐答案
您使用了正确的上网权限?
Are you using the correct Internet permission?
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
这篇关于Android的 - 的WebView =不可用网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文