隐藏键盘二-----隐藏的同时还要接受其他事件
16lz
2021-01-26
在隐藏键盘一中 忘了说了 要加一句
android:configChanges="orientation|keyboardHidden"
这样键盘就是一直隐藏的。
可是如果我像隐藏键盘 还想只接受数字呢:
enter_count.setInputType( InputType.TYPE_NULL );
如此就会啥都不接受 最好的办法就是
EditText editText = (EditText) findViewById(R.id.edt_hello); editText.setKeyListener(new NumberKeyListener() { @Override public int getInputType() { return InputType.TYPE_NULL; } @Override protected char[] getAcceptedChars() { return new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; } });
更多相关文章
- Android(安卓)actionbar左侧小箭头的隐藏
- 【Android】ProgressBar圆形加载样式、进度条样式以及代码控制显
- android键盘谈起和收起监听
- appium---操作手机按键(adb shell input keyevent )
- 利用Java反射技术调用Android中被隐藏的API
- 禁用button的方法
- Android(安卓)fragment 获取id,findViewById为空
- Android(安卓)软键盘之 windowSoftInputMode 分析
- android软键盘的消失事件处理方法