Android EditText大写字母数字键盘 [英] Android EditText upper case alphanumeric keyboard

查看:869
本文介绍了Android EditText大写字母数字键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个EditText,它应该显示字母数字键盘(在键盘上可见的字母和数字).字母必须为大写.我应该为EditText设置哪些属性?我试过了:

I have an EditText and it should display alphanumeric keyboard (both letters and numbers visible on keyboard). Letters must be upper case. What attributes should I set for EditText? I tried:

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="textVisiblePassword"
    android:textAllCaps="true" />

这显示小写字母数字键盘.

This shows lower case alphanumeric keyboard.

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="textCapCharacters"
    android:textAllCaps="true" />

这显示了大写键盘,但没有数字.

And this shows upper case keyboard but without numbers.

我需要这样的键盘:

I need a keyboard like this:

在默认布局上可见的数字和大写字母(无需打开CAPS,或者换句话说,默认情况下打开CAPS).

Both numbers and upper case letters visible on default layout (without the need to switch CAPS on, or in other words with CAPS turned on in default).

推荐答案

您可以使用android:digits属性来限制其他文本

You can android:digits property to restrict other text

android:inputType="textCapCharacters"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "

这篇关于Android EditText大写字母数字键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆