【问题标题】:Android Keyboard not showing安卓键盘不显示
【发布时间】:2011-12-27 02:28:21
【问题描述】:

我正在使用 AlertDialog 显示一个输入框。当我调用 AlertDialog.show() 时,对话框本身的 EditText 会自动聚焦,但不会自动显示软键盘。

如何让软键盘在对话框显示时自动显示? (并且没有物理/硬件键盘)。类似于我按下搜索按钮调用全局搜索时,软键盘会自动显示。

【问题讨论】:

    标签: android keyboard


    【解决方案1】:

    对话框打开后,您可以尝试以下方法,取自here

    InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.toggleSoftInputFromWindow(linearLayout.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
    

    还有其他建议here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-06
      • 2015-07-27
      • 2012-05-01
      • 2012-10-08
      • 2011-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多