解决Android软键盘弹出引起的各种不适
来源:互联网 发布:java 正则匹配 编码 编辑:程序博客网 时间:2024/05/22 16:44
在做输入信息页面的时候,经常会遇到键盘挡住输入框或者将一些控件顶起的情况,android为此提供了一系列的的配置参数供选择,可以在androidmanufist.xml的对应Activity的windowSoftInputMode属性中进行配置:
参数意思如下:
属性值
说明
stateUnspecified
软键盘的状态并没有指定,系统将选择一个合适的状态或依赖于主题的设置。
stateUnchanged
当这个activity出现时,软键盘将一直保持在上一个activity里的状态,无论是隐藏还是显示。
stateHidden
用户选择activity时,软键盘总是被隐藏。
stateAlwaysHidden
当该Activity主窗口获取焦点时,软键盘也总是被隐藏的。
stateVisible
软键盘通常是可见的。
stateAlwaysVisible
用户选择activity时,软键盘总是显示的状态。
adjustUnspecified
【默认设置】通常由系统自行决定是隐藏还是显示。
adjustResize
该Activity总是调整屏幕的大小以便留出软键盘的空间。
adjustPan
当前窗口的内容将自动移动以便当前焦点从不被键盘覆盖和用户能总是看到输入内容的部分。
adjustNothing
英语好的同学看官方文档:
Android : windowSoftInputMode
How the main window of the activity interacts with the window containing the on-screen soft keyboard. The setting for this attribute affects two things:
activity主窗口与软键盘的交互模式,可以用来避免输入法面板遮挡问题,Android1.5后的一个新特性。这个属性的设置能影响两件事情:
- 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 (|).
它的设置必须是下面列表中的一个值,或一个”state…”值加一个”adjust…”值的组合。在任一组设置多个值——多个”state…”values,例如&mdash有未定义的结果。各个值之间用|分开。
For example(例如):
<activity android:windowSoftInputMode="stateVisible|adjustResize" . . . >
Values set here (other than "stateUnspecified" and "adjustUnspecified") override values set in the theme.
在这设置的值(除"stateUnspecified"和"adjustUnspecified"以外)将覆盖在主题中设置的值。
This attribute was introduced in API Level 3.
- 解决Android软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- 如何解决软键盘弹出引起的各种不适
- Android软键盘弹出引起的各种不适终极解决方案
- android软键盘弹出引起的各种不适终极解决方案 .
- android软键盘弹出引起的各种不适终极解决方案
- android软键盘弹出引起的各种不适终极解决方案
- android软键盘弹出引起的各种不适终极解决方案
- android软键盘弹出引起的各种不适终极解决方案
- android软键盘弹出引起的各种不适终极解决方案
- TCP协议图解
- 算法题——投篮比赛获胜的概率
- Unity编程笔录--Unity3D脚本自动添加tag和Layer
- Delphi如何从内存流中判断图片格式,MemoryStream
- 简述==和equles的区别
- 解决Android软键盘弹出引起的各种不适
- 两个Activity之间跳转问题之activity的四种加载模式
- 关于a标签点击后controller在火狐浏览器里执行2次的问题
- Android ScrollView截图和图片保存到相册的方式
- linux netstat命令
- 图床爬虫
- SQL Server 动态行转列(参数化表名、分组列、行转列字段、字段值)
- android中actionBar中字体颜色设置
- 黑马程序员——内部类、异常、包