gpt4 book ai didi

android - 如何将注意力从 EditText 移开?

转载 作者:行者123 更新时间:2023-11-30 04:17:17 26 4
gpt4 key购买 nike

在我的应用程序中,当 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/

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