Activity Full Screen Settings
Method 1:Androidmanifest. xml
<Activity Android: Name = "myacitivty" Android: theme = "@ Android: style/theme. notitlebar. fullscreen"/>
Method 2:Code Implementation
Requestwindowfeature (window. feature_no_title); // hide the title bar
Getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, windowmanager. layoutparams. flag_fullscreen); // hide the status bar
Note:The full screen code must be set before setcontentview (R. layout. Main). Otherwise, an error is returned.
Activity horizontal and vertical Screen Settings
Method 1:Androidmanifest. xml
<Activity Android: Name = "myacitivty" Android: screenorientation = "Landscape"/> // or "portrait"
Method 2:Code Implementation
Setrequestedorientation (activityinfo. screen_orientation_landscape );
Obtain the horizontal screen direction
Int orientation = This. getresources (). getconfiguration (). orientation;
OrientationThe common values can be activityinfo. screen_orientation_landscape (landscape) or activityinfo. screen_orientation_portrait (landscape)
Activity screen always displays
1: androidmanifest. xml add permissions
<Uses-Permission Android: Name = "android. Permission. wake_lock"/>
2: code implementation
Getwindow (). addflags (windowmanager. layoutparams. flag_keep_screen_on );