EditText is selected automatically when project is run
This question already has an answer here:
You can make a method and call it on onCreate() method:
public static void hideSoftKeyboard (Activity activity, View view) {
InputMethodManager imm =(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0);}
or simply you can add in manifest file like this:
<activity android:name="com.your.package.ActivityName"
android:windowSoftInputMode="stateHidden" />
use this code..whenever your project is on, edit-text selected. you will type instantly..
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true"
android:ems="10" >
</EditText>
从XML文件中的<EditText />
中删除<requestfocus />
..请求聚焦意味着它是关注于particulat组件..所以删除它...
下一篇: 当项目运行时,EditText自动被选中