strada android
strada android

Reputation: 39

android inputType="number" and "numberPassword" different keyboards, how to make same keyboards?

When in EditText xml layout I set android:inputType="number" I see one keyboard, with dash, dot and comma. When I set android:inputType="numberPassword" I see another keyboard, only numbers this time.

How do I show keyboard with only numbers, without dot and comma, for a non-password EditText?

Upvotes: 1

Views: 1136

Answers (2)

Javad Dehban
Javad Dehban

Reputation: 1292

you can join 2 types in inputType EditText in android

this link all type for EditText

for example you can use :

android:inputType="numberSigned|numberDecimal"

or

android:inputType="numberDecimal"

Upvotes: 1

snachmsm
snachmsm

Reputation: 19253

if you need only numbers then best option for you would be android:inputType="numberSigned"

and the keyboard... well, in fact keyboard style doesn't depend on you... this is another separated app installed in system and it try to fit inputType of EditText. some keyboard apps may have different buttons for inputType="number" and inputType="numberPassword", some other may have same UI, yet some other may just have one UI with all buttons for all inputTypes (thus some of these buttons may be inactive, e.g. letters when digit-only inputType)

even when your keyboard app provides different keyboard style doesn't mean that on another device with another keyboard app this behavior will be the same

Upvotes: 1

Related Questions