Home » Android » Disable immersive mode for a particular activity

Disable immersive mode for a particular activity

Posted by: admin November 1, 2017 Leave a comment

Questions:

I want to disable the immersive mode (i.e. pop out of the android statusbar on swiping down at the very top of the screen) for one of the activity in my application. I’m using a fullscreen theme in my activity, but whenever i swipe down from the top area statusbar pops out. I want to disable that functionality.

I already tried the solution given here

But it didn’t work for me on API 24.

Answers:

Have you tried fullscreen activity? It looks like this:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.main);
}

set this before content view