网址未在android webview中打开

时间:2011-05-24 08:22:21

标签: android webview

如何在android中的web视图中打开此url https://web150.secure-secure.co.uk/ftpeditor.net/core/homepage.php

2 个答案:

答案 0 :(得分:0)

尝试使用chrome客户端:

    vw = new MyWebView(this);
    vw.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress)
        {
            activity.setTitle("Loading...");
            activity.setProgress(progress * 100);

            if(progress == 100)
                activity.setTitle(R.string.app_name);
        }
    });
    vw.setWebViewClient(new WebViewClient() {
        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
        {
            // Handle the error
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url)
        {
            view.loadUrl(url);
            return true;
        }
    });

答案 1 :(得分:0)

这是完成的代码

package com.myapp;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class MainActivity extends Activity {
WebView webview;



@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    webview = (WebView) findViewById(R.id.webview);

    webview.loadUrl("https://web150.secure-secure.co.uk/ftpeditor.net/core/homepage.php");


}
}