public class SoftInputUtils {/** * 隐藏软键盘 * @param acitivity */public static void closedSoftInput(Activity acitivity){if(null!=acitivity && acitivity.getCurrentFocus()!=null){            if(null!=acitivity.getWindow()){            acitivity.getWindow().getDecorView().clearFocus();                InputMethodManager im = ((InputMethodManager) acitivity.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE));                if(null!=im){                    im.hideSoftInputFromWindow(acitivity.getWindow().getDecorView().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);                }            }        }}/** * 打开软键盘 * @param acitivity */public static void openSoftInput(final Activity acitivity){ Timer timer = new Timer();        timer.schedule(new TimerTask() {           @Override            public void run() {                    InputMethodManager imm = (InputMethodManager)acitivity.getSystemService(Context.INPUT_METHOD_SERVICE);                     imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);             }         }, 300);}}

更多相关文章

  1. android 键盘不弹出
  2. android中隐藏以及显示软键盘代码
  3. android朋友圈监听键盘状态 点击空白区域隐藏键盘
  4. Android监听键盘上的确定键等
  5. Solution of issue: Android soft keyboard overlap with input
  6. android详细解释键盘和鼠标事件
  7. Android虚拟键盘弹出时挡住EditText解决方法
  8. Android各种键盘挡住输入框解决办法

随机推荐

  1. c语言程序的执行总是起始于什么?
  2. vc++6.0怎么新建c语言文件
  3. using用法是什么
  4. c语言volatile关键字的作用是什么?
  5. C语言的标识符由什么组成
  6. C语言中位运算符有哪些
  7. strtok函数的用法是什么
  8. if语句的用法是什么
  9. c语言源程序结构是怎样的?
  10. c语言编译后生成什么文件