OiO.lk Blog Android How do i disable the MapBox Scale using Android jetpack compose
Android

How do i disable the MapBox Scale using Android jetpack compose


Anyone know how you can disable the scale on the mapbox map. I’ve been trying but i just can’t get to wrap my head around it, and there seems to be no documentation on how you can do it on their site.

below is the code for my map widget. am using Jetpack compose Android and running mapbox sdk 11.7.1 on android studio ladybug

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.mapbox.maps.extension.compose.MapEffect
import com.mapbox.maps.extension.compose.MapboxMap
import com.mapbox.maps.extension.compose.animation.viewport.rememberMapViewportState
import com.mapbox.maps.plugin.PuckBearing
import com.mapbox.maps.plugin.locationcomponent.createDefault2DPuck
import com.mapbox.maps.plugin.locationcomponent.location

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
           MapViewActivity()
        }
    }
}
@Composable

fun MapViewActivity() {
    val mapViewportState = rememberMapViewportState()
    MapboxMap(
        Modifier.fillMaxSize(),
        
        mapViewportState = mapViewportState,
    ) {
        MapEffect(Unit) { mapView ->
            mapView.location.updateSettings {
                locationPuck = createDefault2DPuck(withBearing = true)
                pulsingEnabled = true
                enabled = true
                puckBearing = PuckBearing.COURSE
                puckBearingEnabled = true
            }
            mapViewportState.transitionToFollowPuckState()
        }
    }}



You need to sign in to view this answers

Exit mobile version