在做输入信息页面的时候,经常会遇到键盘挡住输入框或者将一些控件顶起的情况,android为此提供了一系列的的配置参数供选择,可以在androidmanufist.xml的对应Activity的windowSoftInputMode属性中进行配置:
详细说明这四个参数:
int | SOFT_INPUT_ADJUST_NOTHING | Adjustment option for softInputMode: set to have a window not adjust for a shown input method. |
int | SOFT_INPUT_ADJUST_PAN | Adjustment option for softInputMode: set to have a window pan when an input method is shown, so it doesn't need to deal with resizing but just panned by the framework to ensure the current input focus is visible. |
int | SOFT_INPUT_ADJUST_RESIZE | Adjustment option for softInputMode: set to allow the window to be resized when an input method is shown, so that its contents are not covered by the input method. |
int | SOFT_INPUT_ADJUST_UNSPECIFIED | Adjustment option for softInputMode: nothing specified. |
四个参数意思如下:
SOFT_INPUT_ADJUST_NOTHING: | 不调整(输入法完全直接覆盖住,未开放此参数) |
SOFT_INPUT_ADJUST_PAN: | 把整个Layout顶上去露出获得焦点的EditText,不压缩多余空间。 |
SOFT_INPUT_ADJUST_RESIZE: | 整个Layout重新编排,重新分配多余空间。 |
SOFT_INPUT_ADJUST_UNSPECIFIED: | 系统自己根据内容自行选择上两种方式的一种执行(默认配置) |
版权声明:本文为博主原创文章,未经博主允许不得转载。