Android应用开放网站

时间:2015-08-12 09:37:45

标签: android hyperlink web

如何在Android应用中简单地打开网站链接? Android App为空,仅适用于此功能。 我需要能够捕获Android 3.2 +

由于

2 个答案:

答案 0 :(得分:0)

您可以使用意图打开页面。

像这样。

String webPage= "http://www.google.com";
Intent intent= new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(webPage));
startActivity(intent);

答案 1 :(得分:0)

在你的布局文件中添加:

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

在你的java类中添加:

    WebView myWebView = (WebView) findViewById(R.id.webview);  
    myWebView.loadUrl("http://www.google.com");

在清单文件中添加:

    <uses-permission android:name="android.permission.INTERNET" />

希望它有所帮助!祝你好运!

相关问题