android 横竖屏切换 简记

横竖屏切换,不重新加载

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-带进度条的系统通知栏消息


下一篇:为什么选择B+树作为数据库索引结构?