Activity fullscreen 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 the status bar
Note: The two-piece code that sets the full screen must precede Setcontentview (r.layout.main), or it will get 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);
Settings page default to vertical screen
Setrequestedorientation (activityinfo.screen_orientation_portrait);
Get the horizontal screen direction
int orientation = This.getresources (). GetConfiguration (). Orientation;
Common values for orientation can be activityinfo.screen_orientation_landscape (horizontal screen) or activityinfo.screen_orientation_portrait (vertical screen)
The activity screen is always displayed
1:androidmanifest.xml Adding permissions
<uses-permission android:name= "Android.permission.WAKE_LOCK"/>
2: Code implementation
GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Android Activity Common function settings (fullscreen, Portrait screen, etc.)