1 package com.example.administrator.myapplication.activity; 2 3 import android.os.Bundle; 4 import android.support.v7.app.AppCompatActivity; 5 import android.webkit.WebView; 6 7 import com.example.administrator.myapplication.R; 8 9 public class WebViewActivity extends AppCompatActivity { 10 WebView webView; 11 @Override 12 protected void onCreate(Bundle savedInstanceState) { 13 super.onCreate(savedInstanceState); 14 setContentView(R.layout.activity_web_view); 15 webView = (WebView) findViewById(R.id.webView); 16 webView.loadUrl("http://www.baidu.com"); 17 } 18 }
1 <WebView 2 android:id="@+id/webView" 3 android:layout_width="match_parent" 4 android:layout_height="wrap_content"></WebView>
时间: 2024-09-29 09:26:30