Android自动弹出软键盘(输入键盘)
16lz
2021-01-23
Android输入框自动弹出键盘显示和关闭1.软键盘的自动弹出
/** * 显示键盘 * * @param et 输入焦点 */public void showInput(final EditText et) { et.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.showSoftInput(et, InputMethodManager.SHOW_IMPLICIT);}
1.关闭软键盘
/** * 此方法只是关闭软键盘 * * @param et 输入焦点 */private void hintKbTwo() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive() && getCurrentFocus() != null) { if (getCurrentFocus().getWindowToken() != null) { imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }}
登录界面软键盘遮挡editText的输入框体验不好,遮挡登录按钮:地址 https://blog.csdn.net/zyy_give/article/details/89391137
更多相关文章
- android监听软键盘enter按键
- Android使EditText和SearchView取消默认焦点
- android.inputmethodservice.KeyboardView 自定义键盘 字体大小
- Android中使EditText失去焦点,edittext禁止弹出键盘
- fullScreen时的软键盘监听(非重写Layout方式)
- EditText无法获取焦点(android:descendantFocusability用法简析 )
- android 输入键盘遮挡页面的问题
- checkbox 与 listview 等混用焦点问题
- 页面未随软键盘上升及android隐藏软键盘总结