Android softkeyboard 和 其他界面关系 softInputMode

来源:互联网 发布:魔方格软件好用吗 编辑:程序博客网 时间:2024/06/05 08:43

转 : http://blog.csdn.net/xww810319/article/details/17397429 and http://blog.csdn.net/harryweasley/article/details/49124385

精要:

“adjustUnspecified”

It is unspecified whether the activity's main window resizes to make room for the soft keyboard, or whether the contents of the window pan to make the current focus visible on-screen. The system will automatically select one of these modes depending on whether the content of the window has any layout views that can scroll their contents. If there is such a view, the window will be resized, on the assumption that scrolling can make all of the window's contents visible within a smaller area.

This is the default setting for the behavior of the main window.
如果不指定windowSoftInputMode,adjustUnspecified这个就是默认的的设置。

“adjustResize”

The activity's main window is always resized to make room for the soft keyboard on screen.

“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.

其他值相关:

描述

“stateUnspecified”

软键盘的状态(是否它是隐藏或可见)没有被指定。系统将选择一个合适的状态或依赖于主题的设置。这个是为了软件盘行为默认的设置。

“stateUnchanged”

软键盘被保持无论它上次是什么状态,是否可见或隐藏,当主窗口出现在前面时。

“stateHidden”

当用户选择该
Activity时,软键盘被隐藏——也就是,当用户确定导航到该Activity时,而不是返回到它由于离开另一个Activity。

“stateAlwaysHidden”

软键盘总是被隐藏的,当该
Activity主窗口获取焦点时。

“stateVisible”

软键盘是可见的,当那个是正常合适的时(当用户导航到Activity主窗口时)。

“stateAlwaysVisible”

当用户选择这个Activity时,软键盘是可见的——也就是,也就是,当用户确定导航到该Activity时,而不是返回到它由于离开另一个
Activity。

“adjustUnspecified”

它不被指定是否该Activity主窗口调整大小以便留出软键盘的空间,或是否窗口上的内容得到屏幕上当前的焦点是可见的。系统将自动选择这些模式中一种主要依赖于是否窗口的内容有任何布局视图能够滚动他们的内容。如果有这样的一个视图,这个窗口将调整大小,这样的假设可以使滚动窗口的内容在一个较小的区域中可见的。这个是主窗口默认的行为设置。

“adjustResize”

该Activity主窗口总是被调整屏幕的大小以便留出软键盘的空间

“adjustPan”

该Activity主窗口并不调整屏幕的大小以便留出软键盘的空间。相反,当前窗口的内容将自动移动以便当前焦点从不被键盘覆盖和用户能总是看到输入内容的部分。这个通常是不期望比调整大小,因为用户可能关闭软键盘以便获得与被覆盖内容的交互操作。

mk 中修改
Android:windowSoftInputMode=”xxx”> xxx:adjustPan or xxx:adjustPan|adjustResize
java代码中修改
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

Note:

1.更多的是对softInputMode 取值的解释。
忒多的意义,不整理就晕。
2.还存在的问题:
a.上述设置在全屏设置的时候ok,能够生效,但是由于Android N 存在多窗口问题。
就目前测试来看,上述的设置在多窗口下不生效。
后续看看。

原创粉丝点击