zoukankan      html  css  js  c++  java
  • Android调用系统软键盘

    /**

     * 

     * @MethodName:closeInputMethod

     * @Description:关闭系统软键盘

     * @throws

     */

    public void closeInputMethod(){

    try {

    ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))

    .hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),

    InputMethodManager.HIDE_NOT_ALWAYS);

    catch (Exception e) { }finally{ }

    }

    /**

     * 

     * @MethodName:openInputMethod

     * @Description:打开系统软键盘

     * @throws

     */

    public void openInputMethod(final EditText editText){

    Timer timer = new Timer();

    timer.schedule(new TimerTask() {

    public void run() {

    InputMethodManager inputManager = (InputMethodManager) editText

    .getContext().getSystemService(

    Context.INPUT_METHOD_SERVICE);

    inputManager.showSoftInput(editText, 0);

    }

    }, 200);

    }

  • 相关阅读:
    hdu 2196(树上点分治)
    hdu 4807(网络流 + 贪心)
    hdu4101
    hdu4216
    hdu 4219, 树形概率DP
    hdu 4127 A*搜索
    hdu 4126
    hdu 5296,15年多校1-7
    poj3436 ACM Computer Factory
    Fence
  • 原文地址:https://www.cnblogs.com/android100/p/android-soft-keyboard.html
Copyright © 2011-2022 走看看