关于android中获取横竖瓶状态
16lz
2021-01-25
安卓3.0开始横竖屏变化时不会触发onConfigurationChanged事件。
因为Activity总是需要重新创建。
判断横竖屏的方法:
在ACTIVITY的onCreate()方法里使用以下判断
if (getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE) {
// If the screen is now in landscape mode
// 横屏显示中
}
else if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
//竖屏 ,标准模式 320x480
}
3.0之前的版本是这样获取横竖屏状态的:
http://blog.csdn.net/tsk/article/details/6633905
更多相关文章
- 获取Android系统中全部正在运行的程序
- android keydown touch事件传递
- Android(安卓)Fragment详解(二):Fragment创建及其生命周期
- android调用webservice方法,参数或返回值使用服务器端类
- Android(安卓)中使用自定义字体的方法
- 每次吃一点Androidの小知识
- if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.....)
- Android(安卓)实现事件监听器的五种处理方法
- android 初识EventBus