Ireader in full-screen and non-full-screen switching, the overall reading view does not show the redraw and jitter image, if simply set the activity of full-screen and non-full-screen switch, because the size of the view changes, there will be jitter phenomenon
Android only provides immersive state blocking in version 4.4, but what about before 4.4?
1. First add the activity properties directly in the androidmanifest.xml that require full-screen display
1
2. Set the activity background as transparent
@Override publicvoid onCreate (Bundle savedinstancestate) { GetWindow ( ). SetFormat (pixelformat.translucent); GetWindow (). setbackgrounddrawable (null); Super . OnCreate (savedinstancestate); Setcontentview (r.layout.activity_main);
3. In the specified trigger code set the full screen and non-full-screen logic switch, such as Ireader is click on the middle of Reading interface
Findviewbyid (r.id.btstartokhttp). Setonclicklistener (NewOnclicklistener () { Public voidOnClick (View v) {if(isfullscreen) {IsFullScreen=false; GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); //Non-fullscreen}Else{IsFullScreen=true; GetWindow (). Clearflags (WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); //clear a non-full-screen flagGetWindow (). Addflags (WindowManager.LayoutParams.FLAG_FULLSCREEN);//set up full-screen flag } } });
At this point you will find that when you click on the switch logic, the translucent color status bar will be at the top of the screen when the shadow is present, and the activity does not have jitter redraw, there is one thing to note is the top of the interface to reserve the height of the status bar left white, if there is a EditText control, the system will default to the interface Swipe down from the top, the status bar will appear for a while to see if it's consistent with the Ireader status bar.
Android ireader Full-screen and non-full-screen switching effect