如果URL以特定字符串结尾,我使用以下代码来隐藏webview。URL加载后无法隐藏webview
webview.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
if (url.endsWith("index.asp")) {
Toast.makeText(getActivity().getApplicationContext(),"Login successfull",Toast.LENGTH_LONG).show();
webview.setVisibility(view.GONE);
}
}
});
但仍web视图如果URL以的index.asp(例如 “http://abc.def/index.asp”)
为什么你隐藏webview'onPageFinished'?检查url是否以该字符串结尾。如果没有打开webview,否则不显示它。 – hrskrs
尝试通过LinearLayout或FragmentView打包webview。你读过这个http://stackoverflow.com/questions/7942219/show-hide-webview-issue? – Vyacheslav
调试并测试您检查的条件是否令人满意。 –