Android enters a new page and a soft keyboard pops up automatically

Write the method of popping up the soft keyboard in the tool class:

public static void showInput(final EditText et) {
        et.post(new Runnable() {
            @Override
            public void run() {
                et.requestFocus();
                InputMethodManager imm = (InputMethodManager) et.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
                imm.showSoftInput(et, InputMethodManager.HIDE_NOT_ALWAYS);
            }
        });

    }

Call this method directly

Published 57 original articles · liked 0 · 10,000+ views

Guess you like

Origin blog.csdn.net/java9832/article/details/105575302