When I solved this problem, I searched a lot of solutions on the Internet, but they couldn’t solve the problem. The
soft keyboard will still pop up. Now I’m sharing this bear’s solution.
- Find the activity that does not want to pop up the soft keyboard in the AndroidManifest.xml file
- Add android:windowSoftInputMode="stateHidden|stateAlwaysHidden" to the activity tag, pay attention to the location, add it in the tag
<activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="stateHidden|stateAlwaysHidden">
- Insert in the corresponding Java file
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//阻止键盘弹出
text.setShowSoftInputOnFocus(false);
}
replace text with your EditView variable name
This method is suitable for Android 5.0 and above (why did not write anything below 5.0, after all, few people use it (●'◡'●)))