0

I've seen lots and lots of questions about selecting the best input Type keypad for edit texts, yet I couldn't find the one that helps me out with a semi calculator app. I have tried decimal, phone, number flag signed and their combination but it doesn't give me what I am looking for.

Is there any input type including numbers, (+), (-) and (.) ? Or how can I create and use this keypad if I have to?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
ANemati
  • 4,766
  • 3
  • 20
  • 13

1 Answers1

2

Have you tried this, it seems to have what you want:

<EditText
    ...
    android:inputType="number"
    />

Aside from numbers and basic operators, it includes the underscore. It even has modulo (%), factorial (!), confusion (?) should you decide to get fancy...

Addition

This is probably closer to what you want, since you apparently aren't looking for an underscore...

<EditText
    ...
    android:inputType="phone"
    />

I only know of the three basic keyboards include in Android. If the "phone" keyboard isn't an acceptable option, you probably have to design your own...

The way I would approach designing a keyboard is like any other app. For this I would use an EditText above a TableLayout to help you organize your grid of buttons. And simply each button click would add the corresponding value to your EditText.

Addition

To clarify, a "phone" keyboard on an HTC:

HTC keyboard

Sam
  • 86,580
  • 20
  • 181
  • 179
  • Yes , But number gives me the whole keyboard with small buttons for numbers and signs, I want it to be only a 4x4 or so of buttons. – ANemati May 08 '12 at 04:37
  • android:inputType="phone" also doesn't give me (.) and to input "2.63+5" I have to go to sign page and go back again! as I said I am looking for 0-9, +, -, ., done and clear button which I think I have to code it! – ANemati May 08 '12 at 04:47
  • Strange, mine does (it even has a P and a W for some reason) . – Sam May 08 '12 at 04:48
  • WOW! does the API level has anything to do with the signs aside the phone keypad? – ANemati May 08 '12 at 04:52
  • Then I think I have to make my own. I already have a page full of textView and editText and I need this keypad to work just as a keypad, pops up and by clicking done goes away, what would be the keyword for this activity? Thank you – ANemati May 08 '12 at 05:02
  • @Sam that is absolutely awesome! I am debugging on a Samsung g2, which gives me a 4x4 set and +/*. all are under one button which leads to another keypad! – ANemati May 08 '12 at 05:08
  • Here is a decent link on designing a custom keyboard. Good Luck! http://stackoverflow.com/q/1896939/1267661 – Sam May 08 '12 at 05:20