我正在使用EditText,並使用EditText的setError屬性對其進行驗證,並且驗證正確。但是我在同一個屏幕上有一個重定向到另一個活動的按鈕。當我按回按鈕並返回到屏幕時,驗證仍然出現。因此,在活動OnPause事件中,我想刪除EditText的驗證。這怎麼可能。從EditText中刪除錯誤
69
A
回答
190
protected void onPause() {
TextView textView = ...; // fetch it as appropriate
textView.setError(null);
}
由於在文檔中提到:
如果誤差爲空,則錯誤消息和圖標將被清除。
3
您也可以使用以下它:
protected void onPause() {
mEditText.setError(null);//removes error
mEditText.clearFocus(); //clear focus from edittext
}
0
只是serError(空)
mEditText.setError(null);
相關問題
- 1. 從EditText刪除所有TextWatchers
- 2. 如何從edittext中刪除字符?
- 3. 從EditText中刪除Spanable圖像
- 4. 從CLI和PHPMyAdmin中刪除PHP錯誤
- 5. 錯誤1783 - instsrv.exe從Win2k3中刪除
- 6. 從刪除的類中獲取錯誤
- 7. 404錯誤後從Google中刪除
- 8. 從數據庫中刪除錯誤
- 9. NancyFx如何從錯誤中刪除tumbbeast
- 10. 從陣列錯誤中刪除元素
- 11. 刪除一個EditText
- 12. 從刪除動態數組中刪除Seg錯誤
- 13. EditText中的錯誤
- 14. DataGridView刪除錯誤
- 15. 刪除2D_array錯誤
- 16. 刪除列錯誤
- 17. JSON刪除錯誤
- 18. Symstore刪除錯誤
- 19. 錯誤從碧霞表刪除 - ResourceNotFound
- 20. 從MySQL刪除時出現SQL錯誤
- 21. 從二叉樹刪除錯誤
- 22. 刪除鏈表時刪除錯誤C
- 23. Excel刪除行刪除錯誤的行
- 24. 從PHP刪除表時刪除mySQL錯誤
- 25. 從ASP.NET直放站項目刪除 - 刪除錯誤...?
- 26. 在Android EditText中,如何從軟鍵盤中刪除建議欄?
- 27. 如何從searchview中的edittext中刪除關閉圖標
- 28. 無法從CursorAdapter中的行中刪除EditText
- 29. 如何防止刪除EditText中的spannable
- 30. Angularjs:從URL錯誤刪除#:500內部錯誤
如此簡單和完美的爲我工作。 – Zapnologica 2015-02-05 17:11:11
thx..works喜歡所需。 – 2018-02-27 16:28:51