Android 显示/隐藏 软键盘 方法
16lz
2021-01-23
来源:Android 源码 /packages/apps/QuickSearchBox/.../SearchActivity.java
1. Import
import android.view.inputmethod.InputMethodManager;
2. HOWTO
/**
* Hides the input method.
*/
protected void hideInputMethod() {
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(mQueryTextView.getWindowToken(), 0);
}
}
protected void showInputMethodForQuery() {
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE);
if (imm != null) {
imm.showSoftInput(mQueryTextView, 0);
}
}
3. More information of others
默认弹出和按钮点击
http://www.eoeandroid.com/thread-13373-1-1.html
更多相关文章
- Android里面WebView加载HTML里面点击按钮调我Android方法
- Android Stdio实现点击按钮出现图片
- Android如何设置圆角按钮
- Android 4.0源码编译错误
- Android 源码阅读之SMS
- 【android-tips】android程序执行adb shell命令(实例源码)
- android 模拟按钮点击
- Android 点击按钮,文字改变颜色