requestFocus not working

前端 未结 5 1653
悲哀的现实
悲哀的现实 2021-01-02 06:41


        
5条回答
  •  清歌不尽
    2021-01-02 07:39

    You can try this in the code if you want to forcefully show the keyboard.

    ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
    

    then you can to use this code to close the keyboard:

    ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(autocomplete_zone.getWindowToken(), 0);
    

提交回复
热议问题