答案 0 :(得分:5)
答案 1 :(得分:2)
我所做的是在显示对话框时锁定方向,然后在完成时将其解锁:
int currentOrientation = getResources().getConfiguration().orientation;
if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); //locks landscape
}
else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); //locks port
}
// do work
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);