【发布时间】:2012-03-22 22:10:36
【问题描述】:
我正在使用onConfigurationChanged()。在那里,当我从 LandScape 更改为 Portrait 时,它正在调用 if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) 并从 LandScape 转换为 Portrait。但是当我从肖像更改为风景时,它不会更改为风景,因为它正在调用if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE),所以它不会从风景更改为肖像。
请帮忙。
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
//int orientation = this.getResources().getConfiguration().orientation;
if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
Log.d("Entered to change as Portrait ","PPPPPPPPPPPPPPPPP");
setContentView(R.layout.settings);
} else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
Log.d("Entered to change as LandScape ","LLLLLLLLLLLLLLLLLLLL");
setContentView(R.layout.settings);
}
}
【问题讨论】:
标签: android