Full Screen without title bar for Android

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.