3

My NumberPicker in setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS) mode and the setWrapSelectorWheel(false) is turned off.

I formatted my Numberpicker with a simple formatter:

mNumberPicker.setFormatter(new NumberPicker.Formatter() {
    @Override
    public String format(int value) {
        return TextUtils.makeQuatityString(getContext(), value, R.plurals.nWeek);
    }
});

Example output: 4 Weeks, where 4 is the value.

The NumberPicker is in a Dialog and after a short click on the value, the "Weeks" disappear, the "4" stays. Now, after a longer click, the formatted text re-appears.

Does anybody now how to fix this?

the_dani
  • 2,466
  • 2
  • 20
  • 46

1 Answers1

3

Looks like this is a bug Others are facing this issue too. Check this question.

This worked for me. I tested at API 24.

      try {
            Field f = NumberPicker.class.getDeclaredField("mInputText");
            f.setAccessible(true);
            EditText inputText = (EditText) f.get(yourPicker);
            inputText.setFilters(new InputFilter[0]);
        } catch (Exception e) {
            e.printStackTrace();
        }
Community
  • 1
  • 1
sauvik
  • 2,224
  • 1
  • 17
  • 25