mapbox-maps-android
mapbox-maps-android copied to clipboard
Jetpack compose map not showing - map foreground-color is how background themes.xml is set
Environment
- Android OS version: 11.0.7.1.HD65BA
- Devices affected: any
- Maps SDK Version: 10.6.0-rc.1
When i open a screen of mapbox i couldn't see map.
My code:
AndroidView(
factory = { MapView(context) },
modifier = Modifier.fillMaxSize()
) { mapView ->
mapView
.getMapboxMap().apply {
loadStyleUri(Style.MAPBOX_STREETS)
addOnStyleLoadedListener {
setCamera(
CameraOptions.Builder()
.center(Point.fromLngLat(46.0, 16.0))
.zoom(2.0)
.build()
)
}
}
}
Later on I discovered the issue were in themes.xml
- if I set it like that
<style name="Theme.AppCompat.MyTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:background">@android:color/holo_red_light</item>
</style>
- but if i delete
item backgroundit shows correctly<style name="Theme.AppCompat.MyTheme" parent="Theme.AppCompat.DayNight.NoActionBar" />
im having the same problem, did you manage to fix It?
There is a response here: https://stackoverflow.com/a/72574810/2457169 maybe it will help future ppl :)
Closing this ticket but please feel free to reopen if you continue to experience this issue.
Facing the same issue.
<style name="Theme.OpenMapsTest" parent="android:Theme.Material.Light.NoActionBar">
`
implementation 'com.mapbox.maps:android:10.13.0'
`
AndroidView( factory = { MapView(context) }, modifier = Modifier.fillMaxHeight().fillMaxWidth(), update = { mapView ->
val mapboxMap = mapView.getMapboxMap()
mapboxMap.apply {
loadStyleUri(Style.LIGHT) { style ->
}
addOnStyleLoadedListener {
setCamera(
CameraOptions.Builder()
.center(
Point.fromLngLat(
100.43785206937319,
5.963021810066703
)
) //100.43815946478934 5.959938586825725
// .center(Point.fromLngLat(55.3089185, 25.255377)) .zoom(15.0) .build()
)
}
}
mapboxMap.setRenderCacheOptions(RenderCacheOptions.Builder().setLargeSize().build())
}
)
implementation 'com.mapbox.maps:android:10.13.0'
try this one, it work on my side. but im stuck here, cannot add button to change layer on runtime.