单击数字键盘关闭键盘并输入数字

时间:2017-08-15 18:21:06

标签: android android-edittext keyboard

我试图点击数字并关闭键盘,因为只需要一个号码,我不知道该怎么做!

< - 已编辑 - >

对不起我的解释,如果还不够,我必须得到套装的分数,比如tenis,最多7分,然后用一把钥匙足够,我有数字键盘,直到这里完美,但我想单击一个数字,然后在editText字段中用数字关闭键盘

2 个答案:

答案 0 :(得分:0)

对该文本字段使用ontextchangedListener,如下所示

self

答案 1 :(得分:0)

关闭键盘:

// Check if no view has focus:
View view = this.getCurrentFocus();
if (view != null) {  
    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}

要设置输入的数字,请使用editText的Listerners

相关问题