How do I set up an Activity to take up all screen space?

1

I want to hide to the notifications bar !!

    
asked by anonymous 19.04.2015 / 18:06

1 answer

2

To occupy the entire screen you have two options:

1 - By Theme

Just use / inherit the @android:style/Theme.NoTitleBar.Fullscreen theme. Remember that you will not have ActionBar , you can use Toolbar to fill this fault.

2 - Programmatically

Just make the removal of the title and set the flag's from FullScreen to Window :

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

Remembering that you need to execute this stretch after the call to super.onCreate and before setContentView . Otherwise it will fail due to the presence of content.

I think the first option is more elegant, it may be softer than the second.

    
19.04.2015 / 18:15