虚拟键盘不会出现

时间:2014-10-27 12:29:50

标签: android delphi firemonkey delphi-xe5

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

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

1 个答案:

答案 0 :(得分:0)

请尝试这种方式,希望这有助于您解决问题。

   /**
     * 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();
        }
    }
相关问题