简体   繁体   中英

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":

替代文字

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM