How to open Keyboard on Button click in android?

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

How can I open Keyboard on Button click in android?

What I want to be like this:

\"enter

3条回答
  •  梦毁少年i
    2021-01-12 03:04

    InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    
    imm.showSoftInput(view, flags)
    

    an example may be:

    InputMethodManager imm = (InputMethodManager) RouteMapActivity.this
        .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(mapView, InputMethodManager.SHOW_IMPLICIT);
    

提交回复
热议问题