【问题标题】:Softkeyboard-text in landscape mode doesn't show all chars of EditText横向模式下的软键盘文本不显示 EditText 的所有字符
【发布时间】:2011-05-06 04:07:20
【问题描述】:

我注意到横向模式下软键盘的文本与纵向模式下的 EditText 字段中显示的字符不同。我使用 EditText 的 keylistener 只接受特殊字符:

private class MyKeylistener extends NumberKeyListener {
    public int getInputType() {
        return InputType.TYPE_CLASS_NUMBER;
    }
    @Override
    protected char[] getAcceptedChars() {
        return new char[] {'0','1','2','3','4','5','6','7','8','9',',','-'};
    }
};

当我在横向模式下输入“,”时,我在软键盘文本中看不到它,但当我将屏幕翻转到纵向模式时,它会出现在 EditText 中。如何使软键盘文本显示所有允许的字符?我附上一张图片来说明我的意思,EditText 是“34,37,39”:

【问题讨论】:

    标签: android keyboard landscape flip android-softkeyboard


    【解决方案1】:

    我找到了答案:-)

    通过使用这一行,您可以简单地在横向模式下隐藏软键盘文本:

    myEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    

    这样,EditText 在横向模式下也可以在键盘上方可见,并且一切都按预期工作。 另见:imeOptions

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-24
      • 2014-05-25
      • 1970-01-01
      • 1970-01-01
      • 2011-06-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多