莫回无
官方文档有介绍可以参考下:https://developer.android.goo...;在APP中暴露一个接口:public class WebAppInterface { Context mContext; /** Instantiate the interface and set the context */ WebAppInterface(Context c) { mContext = c; } /** Show a toast from the web page */ @JavascriptInterface public void showToast(String toast) { Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show(); }}添加到 WebView:WebView webView = (WebView) findViewById(R.id.webview);webView.addJavascriptInterface(new WebAppInterface(this), "Android");在 HTML 中调用:补充:加载 Assets 文件应该使用 android_asset,而不是 assets;wv.loadUrl("file:///android_asset/{path}");