Disable soft keyboard on NumberPicker

前端 未结 11 1146
庸人自扰
庸人自扰 2020-12-22 18:20

I\'m trying to deactivate the soft keyboard when using a NumberPicker to enter numerical values (for aesthetic reasons). This is my layout-xml-code:



        
11条回答
  •  清歌不尽
    2020-12-22 19:05

    The simplest I found to work was :

    numberPicker               = (NumberPicker) myDialogView.findViewById(R.id.myViewId);
    EditText numberPickerChild = (EditText) numberPicker.getChildAt(0);
    numberPickerChild.setFocusable(false);
    numberPickerChild.setInputType(InputType.TYPE_NULL);
    

提交回复
热议问题