How to disable Android Soft Keyboard for a particular activity?

后端 未结 6 1750
南旧
南旧 2021-02-08 11:03

I have an activity with one EditText where I need to input numbers only.

Now, I have defined the Input Type for my EditText to be number only and have drawn up a pretty

6条回答
  •  独厮守ぢ
    2021-02-08 12:02

    If you are using for example ViewGroup it allows you to block the soft keyboard using this method:

    view.setDescendantFocusability(view.FOCUS_BLOCK_DESCENDANTS);
    

    Thanks to this the view will get focus before any of its descendants.

提交回复
热议问题