有时候我们要在自己的应用中打开一个网页.
这是本人用到 的两种方式.
1. 网页放置于自己的ACTIVITY
1.1 在资源文件中申明WIDGET
android:id="@+id/word_web_view" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 1.2在需要打开网页的地方加如下代码. private void test(){ WebView wv = (WebView)findViewById(R.id.word_web_view); wv.loadUrl("http://wap.baidu.com"); } 2. 在新的窗口打开链接. 加入如下代码即可. private void test(){ Uri uri = Uri.parse("http://www.csdn.net"); startActivity(new Intent(Intent.ACTION_VIEW,uri)); }