Android的虚拟键盘监听器 [英] android virtual keyboard listener
问题描述
虽然我已经问这个问题之前,但不力得到任何正确的答案。我有一个EditText当编辑文本的重点是Android的虚拟键盘弹出时,我一直在使用从属性窗口输入法选项添加完成按钮键盘。现在我想执行由$ P $一些动作pssing完成按钮。如何做到这一点?请任何机构的帮助。
Though i have asked the question before but dint get any proper answer. I have an EditText when edit text is focused android virtual keyboard pops up, i have added Done button to the keyboard using ime option from property window. Now i want to perform some action by pressing the Done button. How to do this? Please any body help.
推荐答案
在一个通过的EditText的firest发现参考做到这一点,不是设置初级讲座code乌拉圭回合的EditText:
you an do it by firest finding reference of edittext and than set belows code for ur edittext:
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
performSearch();//do here your stuff f
return true;
}
return false;
}
});
在这里,我已经采取EDITTEXT名称,即REF。 editextbox其中U添加你必须添加actionId ==类型的其中U已经设置好的输入法选项
here i have taken editText name which is ref. editextbox which u added and you have to add actionId==type of ime options which u have setted
这篇关于Android的虚拟键盘监听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!