Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

myLocationViewSettings.setBackgroundTintColor cannot be #00000000 #7116

Closed
ghengeveld opened this issue Nov 18, 2016 · 2 comments
Closed

myLocationViewSettings.setBackgroundTintColor cannot be #00000000 #7116

ghengeveld opened this issue Nov 18, 2016 · 2 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@ghengeveld
Copy link

ghengeveld commented Nov 18, 2016

Platform: Android 5.0
Mapbox SDK version: 4.2.0.beta.3

Steps to trigger behavior

  1. Use MyLocationViewSettings.setForegroundDrawable to show a custom drawable at the user's location
  2. Use MyLocationViewSettings.setBackgroundTintColor with #00000000 (fully transparent black)

In OnMapReadyCallback.onMapReady:

Drawable walkingUserMarker = ContextCompat.getDrawable(context, R.drawable.marker_user_walk);
MyLocationViewSettings myLocationViewSettings = mapboxMap.getMyLocationViewSettings();
myLocationViewSettings.setAccuracyAlpha(0);
myLocationViewSettings.setForegroundDrawable(walkingUserMarker, null);
myLocationViewSettings.setBackgroundTintColor(ContextCompat.getColor(context, R.color.transparent));

In colors.xml:

<color name="transparent">#00000000</color>

Setting the color to #00ffffff avoids this issue and yields the expected result.

Expected behavior

Only the marker drawable should be rendered at the user's location, nothing else.

Actual behavior

The drawable appears with a light gray dot below it. This appears to be the default background tint.

It would be nice to be able to use setBackgroundTintColor(null) to disable the background altogether.

@cammace cammace added the Android Mapbox Maps SDK for Android label Nov 18, 2016
@cammace
Copy link
Contributor

cammace commented Nov 28, 2016

This is due to use checking if it is transparent or not. We should rethink this check or expose a setVisibility method for the foreground/background images. @tobrun what do you think?

@cammace cammace added this to the android-v5.0.0 milestone Nov 28, 2016
@tobrun
Copy link
Member

tobrun commented Nov 29, 2016

Makes sense @cammace, feel free to run with this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

3 participants