0

I was wondering if it was possible to disable screen rotation on the activity of an application but not the menu. So that when the screen is turned the activity isn't destroyed and recreated but it stays, only the menu position shifts according to the rotation.

1 Answers1

1

You can use onConfigurationChanged to detect when the screen switches between landscape / portrait. The best part is that you can change the Configuration object that gets passed to it before calling super.onConfigurationChanged

http://developer.android.com/reference/android/app/Activity.html#onConfigurationChanged%28android.content.res.Configuration%29

Here is another answer which goes through some more options for controlling screen orientation changes

If you want the menu to stay upright as the phone slowly rotates, rather than suddenly switch, you might be able to use SensorEvent ( http://developer.android.com/reference/android/hardware/SensorEvent.html ). I've never used this though so I can't say for sure

Community
  • 1
  • 1
James Coote
  • 1,975
  • 19
  • 29