Adapt To Display Orientation
Description
Android supports two screen orientations: portrait and landscape.
By default, when you change the display orientation of your Android device, the current activity that is displayed automatically redraws its content in the new orientation.
onCreate()
method of the activity is fired
whenever there is a change in display orientation.
When you change the orientation of your Android device, your current activity is actually destroyed and then recreated.
In general, you can employ two techniques to handle changes in screen orientation:
- Anchor views to the four edges of the screen. When the screen orientation changes, the views can anchor neatly to the edges.
- Resize and reposition each and every view according to the current screen orientation.