【问题标题】:Redirect to android webview app when clicked on a link单击链接时重定向到 android webview 应用程序
【发布时间】:2020-07-15 07:04:17
【问题描述】:
【问题讨论】:
标签:
android
android-webview
【解决方案1】:
将WebViewClient 添加到WebView 并覆盖覆盖shouldOverrideUrlLoading。
Kotlin 示例:
binding?.webView?.webViewClient = object : WebViewClient(){
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
request?.url // handle it here and return true or false depend on if you want webview to load it pr you going to handle it your self
return super.shouldOverrideUrlLoading(view, request)
}
}