Clamping values in preference screen
Is there a way to clamp the numeri开发者_JAVA技巧cal value entered into a editTextPreference? I'd like to limit a value to say +- 45.
In addition to setting android:inputType="numberSigned", you would need to setup a KeyListener, or TextWatcher, to enforce the min/max values.
Alternatively, you may want to look into one of the existing views that are intended for this type of limited input, such as NumberPicker
精彩评论