You may use TYPE_CLASS_PHONE, it adds some symbols (#+.), spaces and backspaces.
More infos here: http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_PHONE
Вопрос
I want to show numerical keyboard when edittext is focused. I tried
myEditText.setInputType(InputType.TYPE_CLASS_NUMBER)
but then it only accepts number as an input and ignores backspace etc.
I just want that numerical keyboard is showed rather than letters
Решение 3
You may use TYPE_CLASS_PHONE, it adds some symbols (#+.), spaces and backspaces.
More infos here: http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_PHONE
Другие советы
Do it in your xml layout
<EditText
android:id="@+id/myEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number" />
You do it in two ways.
Do it in your layout
<EditText
android:id="@+id/edittex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"/>
Or in your code.
EditText e = (EditText) findViewById(R.id.edittex);
e.setInputType(InputType.TYPE_CLASS_NUMBER);
or if you want anything like dial keypad which will only show you numbers an dwill me able to take input of Int value. try in code
e.setInputType(InputType.TYPE_CLASS_PHONE);
or in layout
android:inputType="phone"