Android programming realizes the method of not destroying the current activity and locking the screen during horizontal and vertical screen switching
This paper describes the method of Android programming without destroying the current activity and locking the screen when switching between horizontal and vertical screens. Share with you for your reference, as follows:
First, add the Android: configchanges = "orientation|keyboardhidden" attribute to the activity element of mainifest.xml
The meaning of adding this property is that the application will handle the changes of screen orientation and keyboard status (push or close). However, the changes of other device configuration information will be handled by the Android system (destroy the current activity, and then restart a new activity instance).
Now, you need to add the processing code of configuration information change to the activity subclass of Java code. This is also very simple
Don't forget to add
This is OK. When the screen direction changes, the display interface of the application will change instead of being destroyed!
Another property in activity is related to screen orientation:
I hope this article will help you in Android programming.