阅读更多
public class KeyboardUtil {public static void hideSoftInput(Activity acitivity) {InputMethodManager imm = (InputMethodManager) acitivity.getSystemService(Context.INPUT_METHOD_SERVICE);imm.hideSoftInputFromWindow(acitivity.getWindow().getDecorView().getApplicationWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);}public static void showSoftInput(EditText et) {et.requestFocus();InputMethodManager imm = (InputMethodManager) et.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);imm.showSoftInput(et, InputMethodManager.RESULT_UNCHANGED_SHOWN);}public static void showSoftInputDelay(final EditText et) {et.postDelayed(new Runnable() {@Overridepublic void run() {showSoftInput(et);}}, 300);}}




更多相关文章

  1. Android名称、版本和API level的对应关系
  2. A first hand look at building an Android(安卓)application
  3. android EditText 去除边框
  4. 设置 Toolbar(ActionBar) 上的按钮颜色
  5. 设置 Toolbar(ActionBar) 上的按钮颜色
  6. Android(安卓)SparseArray源码阅读
  7. android pdf 阅读器开发, pdf demo, pdf第三方控件
  8. Android(安卓)SparseArray源码阅读
  9. IPC—进程间通信的基础概念--《Android开发艺术探索》阅读笔记—

随机推荐

  1. 实例用户注册及内联框架常用元素代码
  2. 使用表格元素制作课程表
  3. 常用表单示例
  4. Android(安卓)中提高代码安全性-混淆代码
  5. android运行底层linux外部命令的实现
  6. Android几种异步的实现
  7. android M 运行时权限申请流程
  8. Android新的menu实现——ActionMode
  9. Android(安卓)Launcher3一些默认修改
  10. Android(安卓)CountDownTimer倒计时器的