📜  android set focus on edittext - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:20.863000             🧑  作者: Mango

代码示例2
etSearch.requestFocus();
 public void showSoftKeyboard(View view) {
        if (view.requestFocus()) {
            InputMethodManager imm = (InputMethodManager)
                  getSystemService(Context.INPUT_METHOD_SERVICE);
           imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
     }
  }
  
  menifest:
 android:windowSoftInputMode="stateVisible"