Android(安卓)显示/隐藏 软键盘 方法
16lz
2022-01-25
来源: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如何设置圆角按钮
- Android(安卓)统计图表引擎 AChartEngine(三) - 示例源码折线图
- Android(安卓)Stdio实现点击按钮出现图片
- Android的AlertDialog的6种使用情景
- Android里面WebView加载HTML里面点击按钮调我Android方法
- Android(安卓)点击按钮,文字改变颜色
- Android中的MD5加密
- 【android-tips】android程序执行adb shell命令(实例源码)
- Android(安卓)4.0源码编译错误