• Android的EditText无法自动弹出输入法问题 .


    方法1:

    /**
     * 显示键盘
     * 
     * @param context
     * @param view
     */
    public static void showInputMethod(Context context, View view) {
    InputMethodManager im = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    im.showSoftInput(view, 0);
    }

    方法2:

    给activity配置加入android:windowSoftInputMode="adjustResize"。

    问题解决。

    解决方法3.:

    调用代码:

    //自动弹出键盘
    InputMethodManager inputManager = (InputMethodManager) getApplication().getSystemService(Context.INPUT_METHOD_SERVICE);
    inputManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);

    使用handler延时。

    问题解决。

    如果直接在oncreate()中调用,没有进行延时,输入法还是无法弹出。

  • 相关阅读:
    3. CSS 的复合选择器
    2. CSS文本属性
    1. CSS字体属性
    pm2 语法
    Emmet语法
    排序算法之 '归并排序'
    CCS
    CCS
    CCS
    怀旧编程之原生js实现简易导航栏
  • 原文地址:https://www.cnblogs.com/dreamy890322/p/3110519.html
Copyright © 2020-2023  润新知