镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

GoogleMap inside a Dialog glitches and shows unwanted trasparency #588

Open

Description

@matteo-goghero-leitha

Please be sure to include as much information as possible:

Environment details

OS type and version: Android 14 (issue discovered only on Google Pixel 7a)
Library and version: com.google.maps.android:maps-compose:5.0.3
Compose version: BOM 2024.04.00, Compiler 1.5.10

Steps to reproduce

  1. Create a simple layout with some content
  2. Add a composable Dialog on top of this content
  3. Put a GoogleMap inside the aforementioned dialog
  4. Pan and Zoom the map and look closely around streets or railways in particular, you will notice a slight transparency around the border of map's elements that allows to see content beneath the dialog.

Code example

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            Row(modifier = Modifier.fillMaxSize()) {
                Box(Modifier.weight(1f).fillMaxHeight().background(Color.Red))
                Box(Modifier.weight(1f).fillMaxHeight().background(Color.Green))
                Box(Modifier.weight(1f).fillMaxHeight().background(Color.Blue))
            }
            Dialog(
                onDismissRequest = {},
            ) {
                GoogleMap()
            }
        }
    }
}

Screenshots

Screenshot_20240624-145451

Screenshot_20240624-145451

This is what happens in our app, sometimes it glitches even worse

Screenshot_20240624-151916

Footnote

This issue has only been observed on Google Pixel 7a, we tested 2 different 7a and both of them have this issue. Other phones with android 14 including S23 ultra and Pixel 4a do not have this issue.

We have also tried to:

  • put a colored box inside the dialog and behind the map
  • draw a filled rectangle with drawBehind modifier
  • set the GoogleMapOptions.backgroundColor property
    but neither of those have resolved the issue.

Thanks.

Activity

  1. added
    triage meI really want to be triaged.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Jun 24, 2024
  2. matteo-goghero-leitha commented on Jul 29, 2024

    @matteo-goghero-leitha
    Author

    Any updates on this?
    Thank you.

  3. ln-12 commented on Sep 4, 2024

    @ln-12
    Contributor

    I am experiencing the exact same issue when using the map inside a Dialog composable. The background is transparent on a Pixel 7 but it works as expected in the emulator.

    Pixel 7:
    Pixel7

    Emulator:
    Emulator

    I am using Compose 1.6.8 and 6.1.2/4.3.2 of this library.

    Another approach I tried is adding a background directly to the dialog bit it did also not work:

    val localView = LocalView.current
    LaunchedEffect(localView) {
        (localView.parent as? DialogWindowProvider)?.window?.setBackgroundDrawable(android.graphics.drawable.ColorDrawable(android.graphics.Color.RED))
    }
  4. sacelis commented on Oct 11, 2024

    @sacelis

    Any updates on this or maybe a workaround? Thanks

  5. matteo-goghero-leitha commented on Feb 7, 2025

    @matteo-goghero-leitha
    Author

    Hi, any updates? Thank you

  6. matteo-goghero-leitha commented on Sep 3, 2025

    @matteo-goghero-leitha
    Author

    Still no updates or workarounds? Thanks

  7. DanicMa commented on Oct 22, 2025

    @DanicMa

    This still happens on some devices with com.google.maps.android:maps-compose:6.12.1 and androidx.compose:compose-bom:2025.10.00 ... any updates? 🙏

  8. ln-12 commented on Oct 30, 2025

    @ln-12
    Contributor

    This is still a major issue for us. It also happens in satellite mode depending on the zoom level.

    1000053001.mp4
  9. frlgrd commented on Dec 16, 2025

    @frlgrd

    Same issue here with a map in a ModalBottomSheet

    compose BOM : 2025.12.00
    Google maps SDK : 6.12.2

    Screen_recording_20251216_180214.mp4
  10. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    triage meI really want to be triaged.
    on Feb 24, 2026
  11. Enjot commented on Mar 8, 2026

    @Enjot

    I was able to fix this issue by applying this Modifier to the GoogleMap Composable:

    Modifier.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen)

    Should work for both Dialog and ModalBottomSheet.
    Let me know if this fixes your issue as well.

  12. matteo-goghero-leitha commented on Mar 10, 2026

    @matteo-goghero-leitha
    Author

    @Enjot solution did the trick for me, thanks!

  13. Enjot commented on Mar 13, 2026

    @Enjot

    @matteo-goghero-leitha let's keep it open so that authors of the library can fix this on their side

  14. matteo-goghero-leitha commented on Mar 13, 2026

    @matteo-goghero-leitha
    Author

    You're right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions