📅  最后修改于: 2022-03-11 14:53:32.531000             🧑  作者: Mango
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
if (Uri.parse(url).host == getString(R.string.website_domain)) {
return false
}
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
return true
}
override fun onPageFinished(view: WebView, url: String) {
// TODO Auto-generated method stub
super.onPageFinished(view, url)
}
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK && webview.canGoBack()) {
webview.goBack()
return true
}
return super.onKeyDown(keyCode, event)
}