[Android Note] The EditText text box does not get the focus, androidedittext
This is often the case during development. After opening an activity,
The first text box automatically obtains the focus, and the keyboard input box is displayed.This affects the user experience.
Solution:
1. Do not let the text box get the focus and preemptible the focus of the text box, such as adding it to its parent form:
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:orientation="vertical" 6 android:focusable="true" 7 android:focusableInTouchMode="true" 8 tools:context=".MainActivity" > 9 10 <EditText11 android:id="@+id/etMsg"12 android:layout_width="wrap_content"13 android:layout_height="wrap_content"14 />15 </LinearLayout>
2. Do not bring up an input box to get the focus. Add the following to the activity:
1 android:windowSoftInputMode = "stateHidden"
Http://my.oschina.net/helu/blog/142020 ()