Android 界面的横竖屏监听

Configuration configuration=getResources().getConfiguration();
if(configuration.orientation==Configuration.ORIENTATION_LANDSCAPE){
	MainActivity.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏设置
}else {
	MainActivity.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);//横屏设置
}

你可能感兴趣的:(Android)