解决方法
您可以尝试下面的示例…
- if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
- // You can set the value initially by
- // ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED. Once set it
- // retains it's value. The View will be rendered in the specified
- // orientation using the code below.
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
- }