开发者

Clamping values in preference screen

开发者 https://www.devze.com 2023-03-12 20:01 出处:网络
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 wou

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

0

精彩评论

暂无评论...
验证码 换一张
取 消