应用场景
在应用程序里展示一些网页(套着app的外壳,内容是h5页面)
基于webView的混合开发,在Android原生app里,通过webView控件嵌入web页面
效果展示
涉及知识点
1、WebView和h5交互
2、WebView和js交互
代码应用
R.layout.activity_webview_test
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<WebView
android:id="@+id/webview"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:<