I want to have EditTextPreference that accepts my pattern that consists of digits, comma and dash. My InputFilter works well with standard keyboard but I do not want standard but numeric keyboard. I can display it but only digits can be typed - dash and comma has no effect. How can I have numeric keyboard with digits, dash and comma? I tried all numeric* input types.
InputFilter[] filters = {new ValuesInputFilter()};
EditText editText = ((EditTextPreference) findPreference(KEY)).getEditText();
editText.setFilters(filters);
<EditTextPreference
android:key="pref"
android:inputType="number"
android:summary="%s"
/>
InputType phone
was the closest I could find when implementing something like this.
The fallback is to create your own numerical keyboard, it becomes quite simple as it's 10 buttons plus backspace/accept depending on your requirements. This is what I did when creating a pin entry screen for a banking application.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.