1、AndroidManifest.xml中将activity
复制代码 代码如下:
<activity
android:name="com.suma.smartview.activity.LTVDetailActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity>
2、代码里
复制代码 代码如下:
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
//切换为竖屏
if (newConfig.orientation == this.getResources().getConfiguration().ORIENTATION_PORTRAIT) {
}
//切换为横屏
else if (newConfig.orientation == this.getResources().getConfiguration().ORIENTATION_LANDSCAPE) {
}