Search code examples
androidmapboxmapbox-glmapbox-android

How to rotate MapView in MapBox GL?


I want to rotate my activity with MapView without configuration change, relying on sensors. So I need to somehow set rotation to whole map wiew, so compass and watermark will be placed correctly. But after mapView.rotation(angle) it became stretched and glitchy. Is there any way to make it gracefully? Thanks.


Solution

  • The default MapView will use a SurfaceView, this kind of transformation is only supported using TextureView as rendering surface. To enable this, you either set this up with xml attrs as mapbox_renderTextureMode=true or by using MapboxMapOptions#textureMode(true) programatically.