I'm trying to make a full screen dialog in my Android application, but I'm not able to expand it to the status bar. You can see the gray status bar in the image below.
EDIT 1: It seems to be a problem related to the operating system installed and not to the Android components, because I'm experiencing this problem only on certain devices.

AlertDialog creation:
val builder = MaterialAlertDialogBuilder(this, R.style.FullscreenDialogStyle)
val binding = DialogSuccessBinding.inflate(layoutInflater)
binding.SuccessDialogMessage.text = getString(R.string.AddGuestCard_Success)
builder.setView(binding.root)
builder.background = ColorDrawable(getColor(R.color.primary))
builder.setBackgroundInsetBottom(0)
builder.setBackgroundInsetTop(0)
builder.setBackgroundInsetStart(0)
builder.setBackgroundInsetEnd(0)
builder.show()
AlertDialog style:
<style name="FullscreenDialogStyle" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@color/primary</item>
<item name="android:navigationBarColor">@color/primary</item>
<item name="android:statusBarColor">@color/primary</item>
<item name="android:layout_gravity">center</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
</style>
yes, it has camera notch
To make your dialog a full screen by covering the camera notch area (cutout display area), you need to explicitly adjust the display cutout to shortEdges or always using android:windowLayoutInDisplayCutoutMode attribute in the dialog theme:
<style name="FullscreenDialogStyle" parent="Theme.AppCompat.NoActionBar">
....
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
Please check documentation here for further research;.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With