Try this:
<EditText
android:inputType="number"
android:digits="0123456789."
/>
From Code:
weightInput.setKeyListener(DigitsKeyListener.getInstance("0123456789."));
But, it allows the user to include several “.”
See JoeyRA‘s answer for real numbers.
More Related Contents:
- How do i start a new line in String? [duplicate]
- How to stop EditText from gaining focus when an activity starts in Android?
- Android soft keyboard covers EditText field
- Is there a way to define a min and max value for EditText in Android?
- Android EditText delete(backspace) key event
- Soft keyboard open and close listener in an activity in Android
- Turn off autosuggest for EditText?
- How to create EditText with rounded corners?
- Android: Force EditText to remove focus? [duplicate]
- How to create EditText accepts Alphabets only in android?
- Prevent dialog dismissal on screen rotation in Android
- EditText error icon and show password missplaced
- Is there a way to programmatically scroll a scroll view to a specific edit text?
- EditText maxLines not working – user can still input more lines than set
- How to draw rounded rectangle in Android UI?
- How to remove all listeners added with addTextChangedListener
- How to hide underbar in EditText
- How can restrict my EditText input to some special character like backslash(/),tild(~) etc by soft keyboard in android programmatically
- Masked Input Using EditText Widget in Android
- Set unchangeable some part of editText android
- Soft Keyboard shows up on EditText focus ONLY once
- EditText with soft keyboard and “Back” button
- Android different EditText backgrounds for different states using shapes, selector or list
- Custom designing EditText
- Android adjustpan not working after the first time
- How to change the border color(un-focused) of an EditText?
- set textCursorDrawable programmatically
- Show keyboard for edittext when fragment starts
- How to Get EditText maxLength setting in code
- How to Get EditText maxLength setting in code