我要这样做:通过在同一活动中跟随Button来导航三个网页
mWebView = (WebView) findViewById(R.id.webView1);
Button b1 = (Button) findViewById(R.id.button1);
Button b2 = (Button) findViewById(R.id.button2);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("file:///android_asset/j.html");
尝试像:
main_activity.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
MainActivity.java代码对于webView。
WebView myWebView = (WebView) findViewById(R.id.webView2);
myWebView.setWebViewClient(new WebViewClient());
myWebView.loadUrl("http://www.facebook.com");
WebView myWebView1 = (WebView) findViewById(R.id.webView);
myWebView1.setWebViewClient(new WebViewClient());
myWebView1.loadUrl("http://www.google.com");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句