Search code examples
androidkeyboardlandscapeflipandroid-softkeyboard

Softkeyboard-text in landscape mode doesn't show all chars of EditText


I noticed that the text of the Softkeyboard in landscape mode doesn't show the same characters as I see in the EditText field in portrait mode. I use a keylistener for the EditText to only accept special chars:

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',',','-'};
    }
};

When I type in a "," in landscape mode I don't see it in the softkeyboard-text, but it appears in the EditText when I flip the screen to portrait mode. How can I make the softkeyboard-text show all allowed characters? I append a picture to show what I mean, the EditText is "34,37,39":

alt text


Solution

  • I've found an answer :-)

    By using this line you can simply hide the softkeyboard-text in landscape mode:

    myEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    

    This way, the EditText is also visible above the keyboard in landscape mode, and everything works as expected. See also: imeOptions