How can I know when an EditText loses focus?(我怎么知道 EditText 何时失去焦点?)
本文介绍了我怎么知道 EditText 何时失去焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当 EditText
失去焦点时,我需要捕捉,我已经搜索了其他问题,但没有找到答案.
I need to catch when an EditText
loses focus, I've searched other questions but I didn't find an answer.
我像这样使用OnFocusChangeListener
但是,它对我不起作用.
But, it doesn't work for me.
推荐答案
实现setOnFocusChangeListener
的onFocusChange
,hasFocus有个布尔参数.如果这是错误的,您就失去了对另一个控件的关注.
Implement onFocusChange
of setOnFocusChangeListener
and there's a boolean parameter for hasFocus. When this is false, you've lost focus to another control.
这篇关于我怎么知道 EditText 何时失去焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!