在我的应用程序中,当 EditText 失去焦点时,我需要做一些事情。编辑 EditText 时,我不能让它失去焦点。在 Windows Phone 中有 this.Focus();方法,但在 android 中它似乎不一样。我该怎么办???
最佳答案
要远离编辑文本,应该使用 clearFocus();
如果您确实需要在焦点发生变化时处理任何特定事件,那么现在就来了..
**use Focus Change listener on view.**
onFocusChange(View v, boolean hasFocus)
//Called when the focus state of a view has changed.
if(!hasfocus)
{
//Your piece of code if the focus is lost on text view..
}
关于android - 如何将注意力从 EditText 移开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9792421/