码迷,mamicode.com
首页 > 移动开发 > 详细

android 横竖屏切换 简记

时间:2014-08-13 15:02:36      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:android   style   color   os   io   strong   ar   cti   

横竖屏切换,不重新加载

1、activity声明android:configChanges="orientation|keyboardHidden|screenSize"

Up to API 13 there was a new value to the configChanges attribute, screenSize

So if you‘re using large screens make sure to add screenSize in your configChanges attribute:

android:configChanges="orientation|keyboardHidden|screenSize"

2、Activity重写onConfigurationChanged

public void onConfigurationChanged(Configuration newConfig)  

     super.onConfigurationChanged(newConfig);  

 

--------------------------------------------------------------------------------------------

代码切换横竖屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

android 横竖屏切换 简记,布布扣,bubuko.com

android 横竖屏切换 简记

标签:android   style   color   os   io   strong   ar   cti   

原文地址:http://blog.csdn.net/actsai/article/details/38535471

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!