博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android 弹出软键盘属性windowSoftInputMode
阅读量:5924 次
发布时间:2019-06-19

本文共 3170 字,大约阅读时间需要 10 分钟。

hot3.png

一、简介

软件盘设置,会以下面两种方式影响屏幕的显示

1、设置为“可见”或者“不可见”

stateUnchanged、stateHidden、stateAlwaysHidden、stateVisible、stateAlwaysVisible

2、软键盘的展示方式会影响主界面的布局,例如可以是屏幕原有布局改变尺寸,留给软键盘足够的空间。

也可能是,原有布局不变,软键盘覆盖在布局上面。

adjustUnspecified、adjustResize、adjustPan、adjustNothing

设置时,可以设置单一一个属性,或者一个state...加上一个adjust...

二、共有以下十种属性

下面分别介绍以下每种属性的表现

1、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.

这种属性表示,软键盘显示或者不显示没有设定。系统会x选择一个合适的状态,或者根据主题设置的属性来反应。

这个是软键盘的默认属性

2、stateUnchanged

The soft keyboard is kept in whatever state it was last in, whether visible or hidden, when the activity comes to the fore.

设置这种属性后,当activity显示在最上层的时候、软键盘会保持上一个状态,无论是可见或者不可见

3、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.

设置这一属性后、当activity是被明确的打开的时候软键盘设置为隐藏状态。但如果是从另外一个activity返回到当前界面则不会设置。

4、stateAlwaysHidden

The soft keyboard is always hidden when the activity's main window has input focus.

设置这一属性后、当activity在最上层显示时,软键盘就会处于隐藏状态

5、stateVisible

The soft keyboard is visible when that's normally appropriate (when the user is navigating forward to the activity's main window).

设置这一属性后、当activity是被主动打开的时候软键盘设置为显示状态。

6、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.

设置这一属性后、当activity是被明确的打开的时候软键盘设置为可见状态。但如果是从另外一个activity返回到当前界面则不会设置。

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

设置这种属性表示,activity没有设定是选择重新设定尺寸,使软键盘有足够的空间显示,或者软键盘覆盖在原有layout的上面。系统会自动选择一个模式,这个依赖于界面上是否有一个可以滚动的view来滚动界面上的内容。如果有一个这样的view,假定滚动可以使所有的内容在一个更小的位置上显示,则窗口会改变尺寸为软键盘提供空间。

8、adjustResize

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

界面总是会改变尺寸为软键盘提供空间显示。

9、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.

主界面不会改变尺寸。窗口会自动的被覆盖,而且当前的焦点会一直保持不会变,用户一直处于正在打印状态。这种属性很少使用,因为这样会导致用户必须关闭软键盘才能操作灰显部分窗口。

10、adjustNothing

不做任何自适应。

转载于:https://my.oschina.net/adacoder/blog/349083

你可能感兴趣的文章
Groovy入门之二:Map
查看>>
Nginx 无缝升级(Linux +Windows)
查看>>
$resource in AngularJS
查看>>
Xtreme Property Grid
查看>>
kubernetes1.5.1集群安装部署指南之基础组件安装篇
查看>>
描述论的发展
查看>>
Linux的防火墙管理命令:iptables
查看>>
初探django-使用uwsgi+supervisor+nginx来部署服务
查看>>
安装Tomcat
查看>>
Shell的字符串表达式介绍-实践及企业案例脚本剖析
查看>>
Android Fragment实践(一)
查看>>
虚拟机中克隆操作系统后网络的设置
查看>>
CentOS -简单shell
查看>>
我的友情链接
查看>>
KVM+ceph-RBD 快照创建问题
查看>>
javamail使用小记
查看>>
老徐FrankXuLei受邀为 @IGT中国研发中心 讲授《WCF分布式开发与SOA架构设计》课程...
查看>>
interceptor + spring mvc + token 防止表单重复提交
查看>>
ADB的官方概要
查看>>
思科路由器静态路由配置
查看>>