gpt4 book ai didi

Android检测屏幕键盘的完成按键

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

是否可以检测onScreen键盘的Done键何时被按下?

最佳答案

是的,有可能:

editText = (EditText) findViewById(R.id.edit_text);

editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
// do your stuff here
}
return false;
}
});

请注意,您必须导入以下库:

import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;

关于Android检测屏幕键盘的完成按键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5077425/

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