横向模式下的软键盘文本不显示 EditText 的所有字符
我注意到横向模式下软键盘的文本显示的字符与纵向模式下的 EditText 字段中看到的字符不同。我使用 EditText 的按键侦听器仅接受特殊字符:
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”:
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":
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了答案:-)
通过使用这一行,您可以简单地在横向模式下隐藏软键盘文本:
这样,EditText 在横向模式下也可以在键盘上方看到,并且一切都按预期工作。
另请参阅:imeOptions
I've found an answer :-)
By using this line you can simply hide the softkeyboard-text in landscape mode:
This way, the EditText is also visible above the keyboard in landscape mode, and everything works as expected.
See also: imeOptions