Java – Why does BottomSheetDialog turn the status bar black?

Why does BottomSheetDialog turn the status bar black?… here is a solution to the problem.

Why does BottomSheetDialog turn the status bar black?

I implemented a Bottom Sheet in the onCreate() method of the activity as follows:

bottomSheet = new BottomSheetDialog(this);
bottomSheet.setContentView(getLayoutInflater().inflate(R.layout.bottom_sheet, null));;

My activity extends the AppCompat activity and has a TabLayout and ViewPager: almost a standard UI using Material Design.

The problem I’m having is that when show() is called, the status bar immediately goes black, adding a flutter to the otherwise smooth Bottom Sheet single-unfold animation, not to mention changing the app’s color scheme.

I want the status bar to remain the default color associated with my theme and smoothly darken as the Bottom Sheet unfolds.

I’ve done a lot of searching but haven’t been able to find a concrete solution.

Any ideas that might be causing this issue and what steps, if any, I can take to fix it?

Black status bar (UI content removed for simplicity)
Black Status Bar (UI content removed for simplicity)


Add the following to your styles.xml:

 <style name="BottomDialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
    <item name="android:windowTranslucentStatus">true</item>

Then you can add it to your dialog box:


For devices > API 20 This works and smoothly transitions to the darker shadows of my status bar. Hope that helps.

Related Problems and Solutions