Tuesday, 4 December 2018

DialogFragment does not occupy bezel less screen

I am trying to display a dialog fragment in a bezeless phone which has a notch. Here is the screenshot.

enter image description here

As you can see the dialog fragment does not occupies the whole screen and show an ugly grey color at the top.

Here is what i have tried

I am setting the style in DialogFragment

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setStyle(DialogFragment.STYLE_NORMAL, R.style.FullScreenDialogStyle)
    }



<style name="FullScreenDialogStyle" parent="Theme.AppCompat.Dialog">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowActionBar">false</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
    </style>

I am using the same technique for Activity Screen and it works as it occupies the whole bezelless screen but this does not work for dialog fragment



from DialogFragment does not occupy bezel less screen

No comments:

Post a Comment