键盘从纵向切换到横向关闭键盘后视图仍然向上移动
keyboard switching from portrait to landscape the view remains shifted up after closing of keyboard
键盘以纵向模式进入视图,然后旋转到横向模式。
以编程方式关闭键盘
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
关闭键盘后,将在纵向模式下移动的视图向下移动。
如果键盘在竖屏模式下关闭,这会正常工作。或以横向模式打开并以相同模式关闭。
我正在摩托罗拉手机上测试香草 android 和 运行。
更改 activity 清单中的配置如下:
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
键盘以纵向模式进入视图,然后旋转到横向模式。
以编程方式关闭键盘InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
关闭键盘后,将在纵向模式下移动的视图向下移动。
如果键盘在竖屏模式下关闭,这会正常工作。或以横向模式打开并以相同模式关闭。
我正在摩托罗拉手机上测试香草 android 和 运行。
更改 activity 清单中的配置如下:
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"