-1

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: enter image description here

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).

Martin Dusek
  • 1,170
  • 3
  • 16
  • 41
  • Does this answer your question? [Android Capitalize characters not working in phone](https://stackoverflow.com/questions/15492284/android-capitalize-characters-not-working-in-phone) – MMG Mar 26 '20 at 13:05
  • After time we have spent to answer your question, you have changed your question. You should describe your question better at first. See here: https://stackoverflow.com/questions/15492284/android-capitalize-characters-not-working-in-phone – MMG Mar 26 '20 at 13:07
  • I asked: "it should display alphanumeric keyboard (both letters and numbers visible on keyboard)" I think it is clear... – Martin Dusek Mar 26 '20 at 17:11
  • Now it is clear, after we spent time for answering you – MMG Mar 26 '20 at 17:26
  • You can change keyboard style in settings of your phone. User can also set keyboard so that it is invisible at all. But you can make custom keyboard. This question may help you: How can you make a custom keyboard in Android? – MMG Mar 29 '20 at 09:59

3 Answers3

0

try inputType = textVisiblePassword|textCapCharacters

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="textVisiblePassword|textCapCharacters" />
Muhannad Fakhouri
  • 1,468
  • 11
  • 14
0

When you have android:inputType="textCapCharacters", you will have alphanumeric keyboard as you see in these pictures:

enter image description here enter image description here

You can change keyboard style in settings of your phone. User can also set keyboard so that it is invisible at all. But you can make custom keyboard. This question may help you: How can you make a custom keyboard in Android?

MMG
  • 3,226
  • 5
  • 16
  • 43
  • That is not what I need. I need a keyboard with upper case letters and numbers visible on one keyboard. – Martin Dusek Mar 26 '20 at 09:18
  • This way you will have alphanumeric and some other characters like ' : , ? !, if you want to have custom keyboard, it is another question.@Martin Dusek – MMG Mar 26 '20 at 09:21
  • I can see that lower case keyboard with numbers visible on the same keyboard exists. I can also see that we can switch this keyboard to upper case letters by toggling up arrow on the keyboard. So I assume there must be a way we can show upper case keyboard with numbers (without the need to toggle up arrow on the keyboard). Or do I really need custom keyboard to have upper case letters and numbers visible on keyboard? User of my app has to enter this code "F5GN2" and I want to make things as easy for user as possible. So I want to show upper case keyboard with numbers. – Martin Dusek Mar 26 '20 at 10:19
  • I think my answer is correct for this question, I recommend you to ask another quedtion "How can we make custom keyboard"?@Martin Dusek – MMG Mar 26 '20 at 11:02
  • Sorry, you probably didn't understand what I need. I modified my initial post. If you think that the right answer is "make your custom keyboard" then please modify your answer and write there "make your custom keyboard". We will see if that is the correct answer. – Martin Dusek Mar 26 '20 at 11:45
  • You can see this question to make custom keyboard: https://stackoverflow.com/questions/9577304/ @Martin Dusek – MMG Mar 28 '20 at 05:07
0

You can android:digits property to restrict other text

android:inputType="textCapCharacters"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "
Chirag Bhuva
  • 851
  • 7
  • 14