Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 WebView 在 android 中开发类似浏览器的应用程序。在加载 URL 时,我想在服务器返回 404 响应时显示特定的页面/消息/toast。我尝试使用shouldOverrideUrlLoading,但它只能根据 URL 字符串过滤 URL。WebViewClient有没有什么好方法可以在或WebChromeClient(不加载 URL 两次)内获取服务器的响应代码?
shouldOverrideUrlLoading
WebViewClient
WebChromeClient
覆盖的onReceivedError方法WebViewclient
onReceivedError
WebViewclient