How to open Keyboard on Button click in android?

后端 未结 3 493
孤城傲影
孤城傲影 2021-01-12 02:12

How can I open Keyboard on Button click in android?

What I want to be like this:

\"enter

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-12 02:56

    Write this code inside the Button click event to TOGGLE the keyboard:

    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
    

提交回复
热议问题