Open chantellosejo opened 8 years ago
Easily fixed, but the inputType for the EditText allows the user to enter in numeric values with decimals. If you do this, it always sets the value to the picker's minimum value (not desired behavior).
I fixed it with this bit of code:
` private void updateTextAttributes() {
for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); if (child instanceof EditText) { try { Field selectorWheelPaintField = NumberPicker.class.getDeclaredField("mSelectorWheelPaint"); selectorWheelPaintField.setAccessible(true); Paint wheelPaint = ((Paint) selectorWheelPaintField.get(this)); wheelPaint.setColor(mTextColor); wheelPaint.setTextSize(mTextSize); EditText editText = ((EditText) child); editText.setTextColor(mTextColor); editText.setTextSize(pixelsToSp(getContext(), mTextSize)); **editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL);** invalidate(); break; } catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) { e.printStackTrace(); } } } }`
I'll submit a pull request later if you need me to. Thanks!
Thanks for reporting @chanakin, I must admit I never use the editable mode. Added your piece of code in the library I recreated here.
Easily fixed, but the inputType for the EditText allows the user to enter in numeric values with decimals. If you do this, it always sets the value to the picker's minimum value (not desired behavior).
I fixed it with this bit of code:
` private void updateTextAttributes() {
I'll submit a pull request later if you need me to. Thanks!