status bar flicker when exiting fullscreen activity
Asked Answered
S

1

9

I noticed a pretty irritating flicker that happens in the following scenario: display a fullscreen activity and then launch another activity that is not fullscreen.

In my app I use an action bar at the top of the second activity and I clearly see how a flickering is done when switching between the activities.

When the status bar appears, it doesn't smoothly push my activity down, but very quickly and with this annoying flicker.

Is there some API I can use to control this behaviour? Or some other workaround?

Stratovision answered 13/3, 2013 at 8:29 Comment(0)
D
9

I had same issue. Below workaround fixed it, put this code before finishing your first activity.

Handler handler = new Handler();
handler.post(new Runnable() {
    @Override
    public void run() {
        YourActivity.this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    }
});
Dextroamphetamine answered 14/5, 2015 at 13:2 Comment(2)
If it fix your problem you can accept this as answerDextroamphetamine
This was the only answer that worked. I put the following code in the Oncreate before setContentView. ... if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } ... And don't forget to put it in onWindowFocusChanged override method as well.Gunpowder

© 2022 - 2024 — McMap. All rights reserved.