我正在使用 EditText 小部件,并且我正在使用 EditText 的 setError()
方法对其进行验证,并且验证正确。
但是我在同一个屏幕上有一个按钮,可以重定向到另一个 Activity 。当我按下返回按钮并返回屏幕时,验证仍然出现。
所以在 Activity OnPause
事件上,我想删除 EditText 的验证。怎么可能。
最佳答案
protected void onPause () {
TextView textView = ...; // fetch it as appropriate
textView.setError(null);
}
因为如文档中所述:
If the error is null, the error message and icon will be cleared.
关于android - 从先前验证的 EditText 小部件中删除错误指示器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10206799/