0
웹보기를 만들었으며 지금은 google.com을 시작하려고합니다. 모든 것이 올바르게 컴파일되지만 열 때 "웹 페이지를 사용할 수 없음"이라고 표시된 기본 웹 페이지가 표시됩니다. http://www.google.com의 웹 페이지가 일시적으로 다운되거나 영구적으로 새 웹 주소로 이동할 수 있습니다.webview 브라우저가로드되지 않습니다.
웹 페이지를 열려면 어떻게해야합니까? 나는 그것을 열거 자와 나의 전화에서 시험했다. 둘 다 웹 acess 나는 내 휴대 전화에서 브라우저에서 잘 구글을 열 수 있습니다. 다음은
내 webview.jave의 웹보기 매니페스트 및 main.xml에package com.webview;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
public class WebViewActivity extends Activity {
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState)
{
final Activity mActivity = this;
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main);
// Makes Progress bar Visible
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
mWebView.setWebChromeClient(new WebChromeClient()
{
public void onProgressChanged(WebView view, int progress)
{
//Make the bar disappear after URL is loaded, and changes string to Loading...
mActivity .setTitle("Loading...");
mActivity .setProgress(progress * 100); //Make the bar disappear after URL is loaded
}
});
}
}
매니페스트입니다
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.webview"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".WebViewActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
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/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>