android自适应滑动键盘产生的屏幕尺寸变化
2009-02-17 11:04
495 查看
默认情况下,滑动键盘会重新启动activity
要不关闭activity 则可以在manifest.xml中增加 android:configChanges="keyboardHidden|orientation"
然后重载public void onConfigurationChanged(Configuration newConfig) 函数
键盘被抽出后会首先调用onConfigurationChanged
如果你希望滑动键盘不改变屏幕分辨率 则可以增加属性:
android:screenOrientation="portrait">
portrait :竖
landscape: 横
sensor:根据手机的角度自动调整
详细说明:
<activity ...
android:configChanges=[one or more of: "mcc" "mnc" "locale"
"touchscreen" "keyboard" "keyboardHidden"
"navigation" "orientation" "fontScale"]
...
</activity>
android:configChanges
Lists configuration changes that the activity will handle itself. When changes that are not listed occur, the activity is shut down and restarted. When a listed change occurs, the activity remains running and its onConfigurationChanged() method is called.
Any or all of the following strings can be used to set this attribute. Values are separated by '|' — for example, "locale|navigation|orientation".
Value Description
"mcc" The IMSI mobile country code (MCC) has changed — that is, a SIM has been detected and updated the MCC.
"mnc" The IMSI mobile network code (MNC) has changed — that is, a SIM has been detected and updated the MNC.
"locale" The locale has changed — for example, the user has selected a new language that text should be displayed in.
"touchscreen" The touchscreen has changed. (This should never normally happen.)
"keyboard" The keyboard type has changed — for example, the user has plugged in an external keyboard.
"keyboardHidden" The keyboard accessibility has changed — for example, the user has slid the keyboard out to expose it.
"navigation" The navigation type has changed. (This should never normally happen.)
"orientation" The screen orientation has changed — that is, the user has rotated the device.
"fontScale" The font scaling factor has changed — that is, the user has selected a new global font size.
All of these configuration changes can impact the resource values seen by the application. Therefore, when onConfigurationChanged() is called, it will generally be necessary to again retrieve all resources (including view layouts, drawables, and so on) to correctly handle the change.
要不关闭activity 则可以在manifest.xml中增加 android:configChanges="keyboardHidden|orientation"
然后重载public void onConfigurationChanged(Configuration newConfig) 函数
键盘被抽出后会首先调用onConfigurationChanged
如果你希望滑动键盘不改变屏幕分辨率 则可以增加属性:
android:screenOrientation="portrait">
portrait :竖
landscape: 横
sensor:根据手机的角度自动调整
详细说明:
<activity ...
android:configChanges=[one or more of: "mcc" "mnc" "locale"
"touchscreen" "keyboard" "keyboardHidden"
"navigation" "orientation" "fontScale"]
...
</activity>
android:configChanges
Lists configuration changes that the activity will handle itself. When changes that are not listed occur, the activity is shut down and restarted. When a listed change occurs, the activity remains running and its onConfigurationChanged() method is called.
Any or all of the following strings can be used to set this attribute. Values are separated by '|' — for example, "locale|navigation|orientation".
Value Description
"mcc" The IMSI mobile country code (MCC) has changed — that is, a SIM has been detected and updated the MCC.
"mnc" The IMSI mobile network code (MNC) has changed — that is, a SIM has been detected and updated the MNC.
"locale" The locale has changed — for example, the user has selected a new language that text should be displayed in.
"touchscreen" The touchscreen has changed. (This should never normally happen.)
"keyboard" The keyboard type has changed — for example, the user has plugged in an external keyboard.
"keyboardHidden" The keyboard accessibility has changed — for example, the user has slid the keyboard out to expose it.
"navigation" The navigation type has changed. (This should never normally happen.)
"orientation" The screen orientation has changed — that is, the user has rotated the device.
"fontScale" The font scaling factor has changed — that is, the user has selected a new global font size.
All of these configuration changes can impact the resource values seen by the application. Therefore, when onConfigurationChanged() is called, it will generally be necessary to again retrieve all resources (including view layouts, drawables, and so on) to correctly handle the change.
相关文章推荐
- android 界面自适应屏幕尺寸相关
- android 界面自适应屏幕尺寸相关
- 屏幕尺寸发生变化时页面自适应
- Android 屏幕自适应方向尺寸与分辨率
- Android精确适配不同的dpi和屏幕尺寸(附dimens按比例变化数字的工具类)
- Android 屏幕自适应方向尺寸与分辨率
- Android精确适配不同的dpi和屏幕尺寸(附dimens按比例变化数字的工具类)
- Android 屏幕自适应方向尺寸与分辨率
- android 不相同分辨率不同尺寸和相同分辨率不同尺寸自适应屏幕解决方法
- Android编程实现屏幕自适应方向尺寸与分辨率的方法
- Android 屏幕自适应方向尺寸
- android edittext 键盘弹出屏幕自适应
- Android的Activity屏幕切换动画左右滑动切换
- android布局 屏幕自适应
- android 屏幕尺寸 产品类型 文字颜色 背景色 默认Activity 字宽
- android 屏幕自适应
- android 获取屏幕尺寸
- Android平台根据分辨率计算屏幕尺寸
- Android ViewFlipper滑动屏幕切换图片
- Android 屏幕尺寸、分辨率、像素密度等UI设计参考