Android Development: fullscreen and exit fullscreenfrom://http://blog.csdn.net/dyllove98/article/details/88319332013-04-21 20:31 413 people read Comments (0) favorite reports
XML code:
<button android:id= "@+id/button5" android:layout_width= "wrap_content" android: layout_height= "Wrap_content" android:text= "@string/fullscreen" android:onclick= "Changescreen"/ >
Java code:
PrivateStaticBoolean isfull=True;//Full screen settings and exit full screenPrivatevoidSetfullscreen () {//Requestwindowfeature (Window.feature_no_title);GetWindow (). SetFlags (Windowmanager.layoutparams.flag_fullscreen,windowmanager.layoutparams.flag_fullscreen); Isfull=True; }Privatevoid Quitfullscreen () { final windowmanager.layoutparams attrs = GetWindow (). GetAttributes (); Attrs.flags &= (~windowmanager.layoutparams.flag_fullscreen); GetWindow (). SetAttributes (ATTRS); GetWindow (). Clearflags (WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); //requestwindowfeature (Window.feature_custom_title ); Isfull=falsepublic voidif (Isfull==true) {Quitfullscreen ();} else
Append: Start setting without title, fullscreen
@Override void onCreate (Bundle savedinstancestate) { super//this//This . GetWindow (). SetFlags (Windowmanager.layoutparams.flag_fullscreen,windowmanager.layoutparams.flag_ fullscreen); Setcontentview (R.layout.main); }
Android Development: Fullscreen and exit fullscreen