There is no XML associated with this EditText. It's generated in the Activity.
final EditText txtPrice = new EditText(getContext());
txtPrice.setKeyListener(DigitsKeyListener.getInstance(false, false));
txtPrice.setFilters(new InputFilter[] { new InputFilter.LengthFilter(3) });
This is okay, but not ideal. I want to show the Android numeric keyboard, to really simplify things.
How do I call that?
You should set your EditText
input type
final EditText txtPrice = new EditText(getContext());
txtPrice.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER);
This will restrict its inputs to be numbers only, and thus, Android will automatically show only the numeric keyboard.
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.