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

Android : expression iconColor not working #13896

Closed
RoProducts opened this issue Feb 8, 2019 · 2 comments
Closed

Android : expression iconColor not working #13896

RoProducts opened this issue Feb 8, 2019 · 2 comments
Labels
Android Mapbox Maps SDK for Android support

Comments

@RoProducts
Copy link

Hi,

The iconColor expression of a SymbolLayer does not have any affect. Icons remain black or whatever color they are. You can check out this behavior even in your sample app :

https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/dds/CircleLayerClusteringActivity.java#L182

Icon color should be interpolated:
screenshot_20190208-102213_mapbox demo
The iconSize expression instead works

I tried different vector drawables and the "ic_cross.xml" you are using in the samples.
I tried to give the expression any kind of String or number representation, no success.

Please help.

@LukasPaczos
Copy link
Member

LukasPaczos commented Feb 11, 2019

Hey @RoProducts, thanks for using Mapbox! You've actually found an issue with the linked example. The icon is added to the map here, but in order for you to be able to color an icon using the iconColor property, it needs to be declared as an SDF. You can do that by providing a compatible bitmap to the map like

style.addImage(
  "cross-icon-id",
  BitmapUtils.getBitmapFromDrawable(getResources().getDrawable(R.drawable.ic_cross)),
  true
);

where true flag declares that it's an SDF icon. Now, your iconColor property should change the icon correctly.

Closing as answered, however, please let us know if that does not resolve your issue.

@RoProducts
Copy link
Author

RoProducts commented Feb 11, 2019

Hi @LukasPaczos ,

ah, okay this is silly. Costed my several hours trying different icons and expressions.

Thank you however

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

No branches or pull requests

2 participants