How to prevent keyboard from opening when activity is opened in android?
In my android app, in my profile edit page, when I start the activity, the first edittext field is focused (blinking cursor), and the keyboard gets displayed.
How can I keep it being focused on startup (blinking cursor) but prevent the keyboard from showing up? If that is not possible, then just not focus the edittext on startup.
Thanks.
        <EditText
            android:id="@+id/textinput_firstname"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="textPersonName"
            android:text="test" />
只需在你的onCreate(...)方法中添加这行代码即可
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
 Just add this line of code in your Activity onCreate(...) method  
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
 add this line in manifest also.  
android:windowSoftInputMode="stateHidden|adjustResize"
