-
Notifications
You must be signed in to change notification settings - Fork 1.3k
MapView Overlay inside Dialog #6101
Comments
Thank you for reaching out, this "filter" is coming from the dialog theme. Our maps are displayed using a SurfaceView, copying from the Android docs about SurfaceView:
After googling, I can see that there are some hacks to work around this issue, couldn't find a clean solution to post here though but you could try running with some of suggestions given on StackOverflow. Let us know if something worked out for you. For this use-case, I would suggest using our static image api. I seems the image in OP is used to display a non interactive map. An example can be found here: https://www.mapbox.com/api-documentation/?language=Java#static I hope above information get's you on the right track, reach out if you have any other questions. |
Thank you for the quick reply, unfortunately, I am using the MapView as a 'LocationPicker' so a static map will not suffice. I had already looked at possible Solutions concerning SurfaceView in Dialogs, my main problem is that I cannot treat the MapView as a SurfaceView, so I can't call the necessary methods. Upon looking at the class inheritance it appears that MapView extends FrameLayout... My question is whether there is any way for me to access the SurfaceView you are using to display your maps? That way I would most likely be able to fix the problem for me |
You can get a reference to the following SurfaceView found in <SurfaceView
android:id="@+id/surfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent" /> by calling: SurfaceView surfaceView = (SurfaceView) mapView.findViewById(R.id.surfaceView); |
@michaelblind I have been trying this out myself and hitting the same issue you are mentioning. I would advice using an Activity with transparent background instead. This will allows you to create dialog effect. While I find showing a MapView in an Android SDK dialog a very useful feature. It's not in our list of top features to implement. |
We now has an example in our test app using a texture view as workaround, see here. This results in showing the map correctly: |
Platform: Android
Mapbox SDK version: 4.2.0-beta1
Steps to trigger behavior
Using MapView inside Dialog:
Expected behavior
Normal looking Map (Behaviour in version 4.1.1)
Actual behavior
Dark Filter over Map, Map looks as if in Background
Theme: Custom Theme based on Light / Bug exists also with standard theme Light
The text was updated successfully, but these errors were encountered: