Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android make Dialog fullscreen with status bar showing

Tags:

android

dialog

I want to make a dialog box with full screen but not hiding the status bar.

If use style Theme_Light_NoTitleBar_Fullscreen, the dialog box occupies the whole screen.

If use style Theme_Material_Light_NoActionBar_TranslucentDecor, it seems working but the top of the dialog box actually is becoming transparent. I can make it better by enquiring the status bar height and add top padding to my dialog layout. This solution seems works fine, except it does not work if I attached an animation to it.

I am very confused why Google make the dialog box so complicated to use, and if I am doing correctly to make a full screen dialog box here?

like image 450
Calvin Kung Avatar asked Feb 10 '16 00:02

Calvin Kung


2 Answers

Just use THEME_BLACK_NoTitleBar Worked For me!!!

like image 181
Satish Silveri Avatar answered Oct 06 '22 00:10

Satish Silveri


You can use

android.R.style.Theme_Black_NoTitleBar_Fullscreen

AlertDialog.Builder builder = new AlertDialog.Builder(Objects.requireNonNull(getActivity()),
            android.R.style.Theme_Black_NoTitleBar_Fullscreen);

This will use the primaryDarkColor for the status bar.

like image 41
Anubhav Avatar answered Oct 05 '22 23:10

Anubhav