summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/NumberPicker.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/widget/NumberPicker.java')
-rw-r--r--core/java/android/widget/NumberPicker.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 704f6b6..4918e48 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -1361,6 +1361,14 @@ public class NumberPicker extends LinearLayout {
// Allow text entry rather than strictly numeric entry.
mInputText.setRawInputType(InputType.TYPE_CLASS_TEXT
| InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
+ // Make sure the min, max, respect the size of the displayed
+ // values. This will take care of the current value as well.
+ if (getMinValue() >= displayedValues.length) {
+ setMinValue(0);
+ }
+ if (getMaxValue() >= displayedValues.length) {
+ setMaxValue(displayedValues.length - 1);
+ }
} else {
mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
}