Android ireader Full-screen and non-full-screen switching effect implementation

Source: Internet
Author: User

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


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 ( 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

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: 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.