Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only show number buttons on Soft Keyboard in Android?

On the soft keyboard in Android you can set the soft keyboard to show the numbers instead of a-z keyboard using android:inputType="numberDecimal". However, what do I do if I only want to show the top number row 1 2 3 4 5 6 7 8 9 0 and not the following rows starting with @ # $ % ...?

Thanx for listening!

like image 840
Benny Skogberg Avatar asked Jul 28 '10 20:07

Benny Skogberg


People also ask

How do I get my Android keyboard to only show numbers?

The keyboard actually has a full number pad layout too; unlike some keyboards, it's available in any app. To get the number pad, and tap the special character key in the lower left corner of the keyboard.

How do I change the soft keyboard on my Android?

What to Know. Go to Settings > System > Languages & input. Tap Virtual keyboard and choose your keyboard. You can switch between keyboards by selecting the keyboard icon at the bottom of most keyboard apps.

How do I change my Android keyboard to numeric?

First, tap the symbols button in the bottom-left corner of the Gboard keypad. Then, just to the left of the space bar, you'll see a 1 2 3 4 button, with the four numbers arranged two on top of the other. Tap it, and voilà—there's your numeric keypad.


2 Answers

android:inputType="phone" android:digits="1234567890" 

is an option

like image 110
softarn Avatar answered Oct 08 '22 22:10

softarn


You must only add this line on your code:

input.setRawInputType(Configuration.KEYBOARD_12KEY); 

this will show only the numeric keyboard.

like image 28
sergidk Avatar answered Oct 08 '22 23:10

sergidk