17

I'm implementing an Android App and I need a tip. My EditText, usually, is just numbers, but sometimes numbers and letters.

This is the keyboard that I need as "default", when the EditText is focused:

numeric keyboard

If I put android:inputType="phone" or android:inputType="number", the result isn't what I need:

phone layout keyboard

I need numbers and letters. So, is it possible to do? I already tried EVERY inputType. I try to "mix" some inputTypes, like, number | text, but nothing changes.

SeanC
  • 15,695
  • 5
  • 45
  • 66
Beneti
  • 181
  • 1
  • 2
  • 5
  • Add relevant code that you have and you will find that help comes easier – codeMagic Dec 03 '12 at 19:18
  • 1
    OK, but there isn't a relevant code... it's a simple EditText in xml layout file. – Beneti Dec 03 '12 at 19:23
  • You need to display letters and numbers? without switching the layout? – Ahmad Dec 03 '12 at 19:29
  • I guess I don't understand where the problem is then. I thought you had the layouts and were having trouble switching programatically which would require code – codeMagic Dec 03 '12 at 19:53
  • 1
    Ahmad and codeMagic, I need to display the first image. Imagine that I focused one EditText, will show a keyboard with letters. So, I need to click in ?123 at the bottom left, to show numbers (the first image from my question), ok? So, what I'm trying to do is: when I focus the EditText show the numbers, without any click. BUT I need to be able to switch to letters, so android:inputType="number" doesn't work in my case, because if I do, I can't "back" to letters. – Beneti Dec 04 '12 at 11:16
  • Hi Beneti, i wanna do this in my application, any progress in this problem? Please suggest if you got the solution – fargath Aug 23 '13 at 06:45

3 Answers3

7

try this

android:inputType="textVisiblePassword"

source

Community
  • 1
  • 1
Zainal Fahrudin
  • 536
  • 4
  • 23
-2

If you want a general keyboard you can use this:

android:inputType="text"

This will allow you to use default keyboard with all the special characters, numerics and alphabets one needs.

Looking at the date when this question was asked no doubt it was a hassle to feed the type of keyboard desired. Anyways, if you are still tracking this question. Here's the answer.

Karan Thakkar
  • 1,007
  • 5
  • 24
  • 41
-3
<EditText android:inputType="number" ... /> 

Above code must need 1.5 or up version if its not working also try

EditText num = new EditText(this);
num.setInputType(InputType.TYPE_CLASS_NUMBER);
KRUNAL DOSHI
  • 81
  • 1
  • 2
  • 10
  • As I said, doesn't work, for me. The result of android:inputType="number" is the second image. – Beneti Dec 04 '12 at 11:08