This is the default setting for the behavior of the main window.
"adjustResize" The activity's main window is always resized to make room for the soft keyboard on screen.
这个可以让view自己调整大小以便显示软键盘。这样的话控件可能会变形。
"adjustPan" The activity's main window is not resized to make room for the soft keyboard.
Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing.
This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
这种方式是通过调整view的空白区域来显示软键盘。即使调整空白区域,软键盘还是有可能遮挡一些有内容区域。这样的话用户就只有退出软键盘才能看到这些被遮挡区域并进行交互。
官方相关文档地址:
如何监听软键盘是否打开?
到目前为止还没找到监听软键盘是否被开启的方法。
网上建议用onConfigurationChanged (Configuration newConfig)的来对Configuration的keyboardHidden来监听的方法在三星的手机上也无效。
public int keyboardHidden
Since: API Level 1
A flag indicating whether any keyboard is available.
Unlike hardKeyboardHidden, this also takes into account a soft keyboard,
so if the hard keyboard is hidden but there is soft keyboard available, it will be set to NO.
Value is one of: KEYBOARDHIDDEN_NO, KEYBOARDHIDDEN_YES.
注:在三星的手机上可以同过监听广播来监听软键盘的开启和隐藏。