Android 软键盘先显示数字视图
我的应用程序上有一个登录屏幕,它接受 CPF 作为登录名(CPF 是每个巴西公民都有的唯一号码标识,例如:10546819546),但它也可以接受护照号码作为登录名,并且上面可能有字母。
我的问题是我希望键盘在弹出时在默认字母表之前显示数字/符号“视图”。将 inputMethod 更改为电话或号码并不能解决我的问题,因为正如我所说,登录名可能包含字母。
我见过一些与我的问题有些相似的解释,但它们要么没有解决我的问题,要么太复杂。
这只是一个小调整,以稍微改善用户体验并让我开发应用程序变得有趣,所以如果解决方案是“覆盖默认键盘,创建自定义组件”等,我将不理会它。
TL;DR:我想在字母 1 之前显示数字/符号软键盘。
I have a login screen on my app which accepts a CPF as login (CPF is an unique number identification that every Brazilian citizen have, e.g: 10546819546), but it can also accept passport numbers as the login, and these may have letters on it.
My problem is that I want the keyboard, when it pops up, to show to number/symbols "view" before the default alphabet one. Changing the inputMethod to phone or number does not solve my problem, because as I said, the login may contain letters.
I've seen some explanations to questions somewhat similar to mine but all of them either didn't solve my problem or it was too overcomplicated.
This is merely a small adjust to slightly improve user experience and entertain me developing the app, so if the solution is something like "override the default keyboard, make a custom component" etc, I'll just leave it alone.
TL;DR: I want to show the number/symbol soft keyboard before the letters one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,当谈到软键盘时,你在某种程度上受到了用户为他们的设备设置的软键盘的制造者的摆布。许多设备都预装并默认使用 swype 键盘。但许多其他设备都拥有由该设备制造商制造的软键盘。由创建它的人来决定键盘如何对您传递给它的
android:inputType
做出反应。当您将它们设置为号码或电话时,现在可能有一些实际上具有您正在寻找的行为。我刚刚在我的助手上查了一下,发现和你的一样,号码和电话都无法输入字母。Unfortunately when it comes to the soft keyboard you are somewhat at the mercy of whoever made the one the user has their device set to. Lots of devices come pre-loaded and defaulted to the swype keyboard. But many others have soft keyboards that were made by the manufacturer of that device. It it up to whoever created it to decide how the keyboard reacts to the
android:inputType
that you pass to it. It is possible that some of the ones out there right now actual have the behavior you are looking for when you set them to number or phone. I just checked it out on my sidekick and found that it was the same as yours both number and phone provided no way to input letters.