5

I want to have input type for the text boxes that only takes numbers and decimal point. Input type of Number or Decimal, still brings the full keypad and the buttons are small. Input type of Phone does the trick, but not all phones have a comma or a period/dot to enter the decimal point.

What is the best way around?

Phones without a period:

  1. Samsung Galaxy Tab
  2. Kindle Fire
Kara
  • 6,115
  • 16
  • 50
  • 57
Tawani
  • 11,067
  • 20
  • 82
  • 106
  • I don't have an answer, and I am not trying to sound condescending, but what phones don't have a period? Every device I have handled has had one. – ahodder Apr 02 '12 at 15:22
  • 2
    They don't allow period because the OP is using the Phone input type, i.e. the dialler, and you don't put periods in phone numbers. – Rob Pridham Apr 02 '12 at 15:27
  • It's probably also worth me saying that input types of number/numberSigned/numberDecimal show the keypad in numeric mode for me, much like [this](http://maistutoriais.com/wp-content/uploads/2010/11/SwiftKey-numeric.jpg). I'm using Swiftkey on Android 2.3.7, and your results obviously vary, but its working means that there is a mechanism for it. I'd keep doing what you're doing - using Number. – Rob Pridham Apr 02 '12 at 15:33

2 Answers2

0

The correct way would be to use an input type of number or decimal. After that, it's up to the keyboard to translate this into a layout that makes it easiest to enter numbers.

lrAndroid
  • 2,834
  • 18
  • 27
0

Input type of Number or Decimal, still brings the full keypad and the buttons are small.

That will vary by user. Different devices have different input method editors (a.k.a., soft keyboards). Your inputType value is a request, not a demand. What a given input method editor does for a given inputType is up to the input method editor. Some will have big buttons. Some will have small buttons. Some will have no buttons, because they are designed to use with gestures (e.g., the Graffiti keyboard).

What is the best way around?

Use numberDecimal for your inputType.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491