I'm having trouble with the Dialog in Jetpack Compose. I am working on a Kiosk Mode app that runs on...
t
I'm having trouble with the Dialog in Jetpack Compose. I am working on a Kiosk Mode app that runs on a massive screen. For the scaling to work correctly we had to add the following code in our MainActivity:
Copy code
// Fixes the issue that the DisplayMetrics 1.5x's the size of everything
    override fun attachBaseContext(newBase: Context?) {
        val newOverride = Configuration(newBase?.resources?.configuration)
        newOverride.densityDpi = DisplayMetrics.DENSITY_MEDIUM
        applyOverrideConfiguration(newOverride)

        super.attachBaseContext(newBase)
    }
This forces our scaling to just be 1.0 The thing is that when you use a Dialog it seems to only use 2/3th of the available height and width of the screen to display its contents. The scrim however does fill the entire screen. This issue also does not happen on an Emulator, only on the physical device which is build with a Custom AOSP PCB board. Does anyone know how I can force the Dialog Content to match the size of the scrim? FillMaxSize does only fill 2/3th...
a
Dialogs on Android have some built in constraints such as the width you mentioned. The built in Dialog composable uses the platform dialog so you would have to go custom. It requires you to create a full screen dialog using a Theme and then use that dialog via a composable. That's the reason why I built this so that you can get a dialog that behaves the same on all platforms. If you want to do it on your own, have a look at: https://github.com/composablehorizons/composables-core/blob/main/core/src/androidMain/kotlin/Dialog.android.kt on how to build a full screen dialog for Android PS: On the code above i am making it full screen and remove the scrim. you would have to remove the transparency in your case
t
That seems to work. Thanks!
💯 1
156 Views