Activity full-screen Settings
Way 1:androidmanifest.xml
<activity android:name= "myacitivty" Android:theme= "@android: Style/theme.notitlebar.fullscreen"/>
Mode 2: Code implementation
Requestwindowfeature (Window.feature_no_title); Hide title bar
GetWindow (). SetFlags (Windowmanager.layoutparams.flag_fullscreen,windowmanager.layoutparams.flag_fullscreen); Hide Status bar
Note: The two pieces of code that set the full screen must be before Setcontentview (R.layout.main), or it will be an error.
Activity screen Settings
Way 1:androidmanifest.xml
<activity android:name= "myacitivty" android:screenorientation= "Landscape"/>/or "portrait"
Mode 2: Code implementation
Setrequestedorientation (Activityinfo.screen_orientation_landscape);
Get horizontal screen direction
int orientation = This.getresources (). GetConfiguration (). Orientation;
Common values for orientation can be activityinfo.screen_orientation_landscape (horizontal) or activityinfo.screen_orientation_portrait (vertical screen)
The Activity screen always shows
1:androidmanifest.xml Add Permissions
<uses-permission android:name= "Android.permission.WAKE_LOCK"/>
2: Code implementation
GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);