gpt4 book ai didi

android - 从先前验证的 EditText 小部件中删除错误指示器

转载 作者:IT老高 更新时间:2023-10-28 13:06:28 28 4
gpt4 key购买 nike

我正在使用 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com