Categories : Java

In Fragment

// Hide status bar
View windowDecorView = requireActivity().getWindow().getDecorView(); 
windowDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);

// Show status bar
View windowDecorView = requireActivity().getWindow().getDecorView(); 
windowDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);

In Activity

// Hide status bar
View windowDecorView = getWindow().getDecorView(); 
windowDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);

// Show status bar
View windowDecorView = getWindow().getDecorView(); 
windowDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);

Leave a Reply

Your email address will not be published.