1. Use the activity's default property in the manifest file. When horizontal screen vertical screen, Hui repeatedly call ondestory and oncreate cause unnecessary overhead. The Android default should be to fit a different XML layout file. Once again, initializing the resource will show better results.
2. Configure the properties of the activity in the manifest file:
Android:configchanges= "Orientation|screensize"
The callback function will be in the activity:
public void onconfigurationchanged (Configuration newconfig) {
Super.onconfigurationchanged (Newconfig);
LOG.I (TAG, "onconfigurationchanged:" + newconfig);
};
Can be in this function newconfig the number of parameters, set the level of the need for the replacement of resources and other operations.
Of course: can use the android:screenorientation= "portrait" in the manifest or android:screenorientation= "Landscape" (horizontal) directly control the vertical screen.
How to use Android configchanges