This post is reproduced, not prepared by myself.
During the UI design, we often need to set the screen to no title bar or full screen. It is also very easy to implement. There are two main methods: Configuring XML files and writingCode.
1.In the XML fileConfiguration
In the androidmanifest. xml file of the project, find the activity that needs to be full screen or set to no title bar.Configure the activity as follows.
Achieve full screen effect:
Android: theme = "@ Android: style/theme. notitlebar. fullscreen"
Implement a task bar without a title bar (but with a built-in taskbar ):
Android: theme = "@ Android: style/theme. notitlebar"
2.Write code settings
InProgramYou only need to add the following code to the oncreate () method.
Achieve full screen effect:
Getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, windowmanager. layoutparams. flag_fullscreen );
Implement a task bar without a title bar (but with a built-in taskbar ):
Requestwindowfeature (window. feature_no_title );
Appendix: Android built-in style
Android: theme = "@ Android: style/theme. dialog "shows an activity as the Android: theme =" @ Android: style/theme. notitlebar "does not display the application title bar Android: theme =" @ Android: style/theme. notitlebar. fullscreen "does not display the application title bar, and full screen Android: theme =" theme. light "Background: white Android: theme =" theme. light. notitlebar "the white background does not have a title bar. Android: theme =" theme. light. notitlebar. fullscreen "white background, no title bar, full screen Android: theme =" theme. black "background black Android: theme =" theme. black. notitlebar "the black background does not have a title bar. Android: theme =" theme. black. notitlebar. fullscreen "black background, no title bar, full screen Android: theme =" theme. wallpaper "uses the system desktop as the application background Android: theme =" theme. wallpaper. notitlebar "uses the system desktop as the background of the application without the title bar Android: theme =" theme. wallpaper. notitlebar. fullscreen "uses the system desktop as the application background without a title bar. Full Screen Android: theme =" Translucent "transparent background Android: theme =" theme. translucent. notitlebar "transparent background with no title Android: theme =" theme. translucent. notitlebar. fullscreen "transparent background with no title, full screen Android: theme =" theme. panel "Panel style display Android: theme =" theme. light. panel "Panel style display