android:windowSoftInputMode
2016-01-25 18:08
405 查看
android:windowSoftInputModeHow the main window of the activity interacts with the window containing the on-screen soft keyboard. The setting for this attribute affects two things:
The state of the soft keyboard — whether it is hidden or visible — when the activity becomes the focus of user attention.
The adjustment made to the activity's main window — whether it is resized smaller to make room for the soft keyboard or whether its contents pan to make the current focus visible when part of the window is covered by the soft
keyboard.
The setting must be one of the values listed in the following table, or a combination of one "
state..." value plus one "
adjust..." value. Setting multiple values in either
group — multiple "
state..." values, for example — has undefined results. Individual values are separated by a vertical bar (
|). For example:
<activity android:windowSoftInputMode="stateVisible|adjustResize" . . . >
Values set here (other than "
stateUnspecified" and "
adjustUnspecified") override values set in the theme.
Value | Description |
---|---|
"stateUnspecified" | The state of the soft keyboard (whether it is hidden or visible) is not specified. The system will choose an appropriate state or rely on the setting in the theme. This is the default setting for the behavior of the soft keyboard. |
"stateUnchanged" | The soft keyboard is kept in whatever state it was last in, whether visible or hidden, when the activity comes to the fore. |
"stateHidden" | The soft keyboard is hidden when the user chooses the activity — that is, when the user affirmatively navigates forward to the activity, rather than backs into it because of leaving another activity. |
"stateAlwaysHidden" | The soft keyboard is always hidden when the activity's main window has input focus. |
"stateVisible" | The soft keyboard is visible when that's normally appropriate (when the user is navigating forward to the activity's main window). |
"stateAlwaysVisible" | The soft keyboard is made visible when the user chooses the activity — that is, when the user affirmatively navigates forward to the activity, rather than backs into it because of leaving another activity. |
"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. |
"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. |
INTRODUCED IN:
API Level 1 for all attributes except for
noHistoryand
windowSoftInputMode,
which were added in API Level 3.
相关文章推荐
- Android之Handler详解
- Android中用SP(SharedPreferences)保存数据
- android用ant脚本集成编译过程中出现的9-patch image错误
- Android QQ小红点的实现(附完整注释)
- Android开发之DrawerLayout
- notification遇到的坑
- 10 条提升 Android 性能的建议(转)
- Android apk 加固
- Android 知识点总结
- android L SystemProperties属性解析
- Android Studio 打包apk,自动追加版本号和版本名称
- Android FragmentActivity 和Activity的关系
- Android Binder机制浅析
- RxAndroid+Retrofit环境搭建
- Android 循环广告位轮播图的封装实现
- RecyclerView的使用
- Android 系统发送短信给多个联系人使用
- Android数据存储实现的5大方式
- Android开发——多媒体开发之MediaPlayer
- android PopupWindow详解