1.修改Manifest文件下的Activity配置
android:configChanges="keyboard"
android:screenOrientation="portrait"
android:theme="@style/MyApplicationTheme.NoActionBar"
android:windowSoftInputMode="stateHidden|adjustResize"
切记:android:configChanges="keyboard",有的文章让设置为:keyboardHidden,结果就是每次都会把输入框遮挡住!
2.代码设置
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
网友评论