During development, we often need to set our application to full screen. Here I know two methods, one is inCodeIn the configuration file!
Next I will briefly introduce the various settings.
1. Set in the Code:
Java code:
- Public void oncreate (bundle savedinstancestate ){
- Super. oncreate (savedinstancestate );
- // Set no title
- Requestwindowfeature (window. feature_no_title );
- // Set full screen
- Getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen,
- Windowmanager. layoutparams. flag_fullscreen );
- Setcontentview (R. layout. Main );
- }
It should be emphasized that the full screen code must be before setcontentview (R. layout. Main), or an error will be reported.
2. modify it in the configuration file (Android: theme = "@ Android: style/theme. notitlebar. fullscreen "):
JAVA code:
Android: theme =" @ Android: style/theme. notitlebar. fullscreen "
Android: Label =" @ string/app_name ">