2 개의 편집 및 버튼이있는 간단한 앱이 있는데, 앱을 실행하면 아무 것도하지 않는 동안 소프트 키보드가 자동으로 나타납니다. Edittext를 클릭하면 소프트 키보드가 나타납니다. 당신에게 나는 어떤 글을 읽고이 일을 한시작 소프트 키 닫기 앱
<EditText
android:id="@+id/username"
android:hint="Email/Phone"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/password"
android:hint="Password"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/btn_login"
android:text="Login"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
모든
MainActivity.xml 감사,하지만 난 버튼을 클릭 할 때에만 작동 :
InputMethodManager imm;
imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(username.getWindowToken(),0);
android : descendantFocusability = "beforeDescendants"는 부모 레이아웃 –