NumberPicker is set to the characters "Off" and a number between 1 and 60.
The soft keyboard when you press and hold this NumberPicker is in Japanese character input mode.
I want to set the initial display value of this soft keyboard to numeric input mode, but I don't know how.

Applicable source code
            android: id = "@ + id/np_fadeIn"
            android: layout_width = "wrap_content"
            android: layout_height = "wrap_content"
            android: theme = "@ style/PickerText"
            android: layout_marginLeft = "20dp"
            android: layout_marginRight = "20dp"
            android: layout_gravity = "center" />
// initial setting of number picker
        np_fadeIn = layout.findViewById (R.id.np_fadeIn);
        // Set the number picker
        String [] pref;
        pref = new String [61];
        pref [0] = getString (R.string.off);
        for (int i = 1;i<= 60;i ++) {
            pref [i] = String.valueOf (i);
        // Specify minimum and maximum array index
        np_fadeIn.setMinValue (0);
        np_fadeIn.setMaxValue (60);
        // Set the array to numberPicker
        np_fadeIn.setDisplayedValues ​​(pref);
Supplemental information (FW/tool version etc.)

Android Studio3.4
API level 14 to 28

  • Answer # 1

    If you call setDisplayedValues, InputType will be set to TYPE_CLASS_TEXT at that point, so you need to change it explicitly.

    np_fadeIn.setDisplayedValues ​​(pref);
    // Get private ID
    @IdRes int inputId = Resources.getSystem (). GetIdentifier ("numberpicker_input", "id", "android");
    EditText input = np_fadeIn.findViewById (inputId);
    input.setRawInputType (InputType.TYPE_CLASS_NUMBER);