【问题标题】:Virtual keyboard does not appear虚拟键盘不出现
【发布时间】:2014-10-27 12:29:49
【问题描述】:

当我的移动应用程序正在加载时,我会调用处理相机的表单来拍摄收据的照片。返回上传表单后,如果我选择编辑,则不会出现虚拟键盘。

可能有这个问题?有没有办法强制这个键盘出现?

【问题讨论】:

  • 将焦点设置在 EditText 或 TextView 字段上
  • 我试过没有解决问题。它专注于编辑,但不再出现要写入的光标。

标签: android delphi firemonkey delphi-xe5


【解决方案1】:

试试这个方法,希望能帮助你解决问题。

   /**
     * This method used to hide soft keyboard.
     */
    public void hideSoftKeyboard() {
        try {
            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
            inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    /**
     * This method used to show soft keyboard.
     */
    public void showSoftKeyboard() {
        try {
            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
            inputMethodManager.toggleSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.SHOW_FORCED, 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-03
    • 2015-01-02
    • 2013-04-02
    相关资源
    最近更新 更多