Android TextField : set focus + soft input programmatically

Good sir, try this:

edittext.setFocusableInTouchMode(true);
edittext.requestFocus();

Im not sure, but this might be required on some phones (some of the older devices):

finalInputMethodManager inputMethodManager =(InputMethodManager) context
                .getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(edittext,InputMethodManager.SHOW_IMPLICIT);
View Code


http://stackoverflow.com/questions/8080579/android-textfield-set-focus-soft-input-programmatically
原文地址:https://www.cnblogs.com/stevenlxq/p/3447627.html