阅读 27

webview

webView监听返回键

webView.setOnKeyListener((v, keyCode, event) -> {
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        if (keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) {
            webView.goBack();
            return true;
        }
    }
    return false;
});
复制代码
文章分类
Android
文章标签