How not to show a space, when to hide / show the action bar?

I searched for the answer to this question for two days, but could not find.

I try to hide the action bar to show the image correctly, but whenever I hide / show the action bar, the activity shows a white area at the bottom. I know that this is due to the resizing of the window on the hide / show action bar screen, it is also the default animation from Android, but I need to change this color (black) or not show this space. But how can I do this?

I tried to set the activity background in black, but it still does not work.

eg. USA Today app does this in the Day in Pictures section

Please any help would be appreciated!

Thanks in advance.

+4
source share
3 answers

Have you tried to set the action bar to overlap the content area instead of resting on top of it? In your onCreate (), add this at the top right after calling super.onCreate ():

getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); 
0
source

this code worked for me like a charm

 // This snippet hides the system bars. private void hideSystemUI() { // Set the IMMERSIVE flag. // Set the content to appear under the system bars so that the content // doesn't resize when the system bars hide and show. View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar | View.SYSTEM_UI_FLAG_IMMERSIVE); } private void showSystemUI() { //make nav bar transparent Window window = getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); View decorView = window.getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } 
0
source

No need to do what Karakuri offers; hide all menu items on the action bar, and the bar disappears.

-2
source

Source: https://habr.com/ru/post/1497065/


All Articles