【发布时间】:2019-08-31 22:57:30
【问题描述】:
我正在尝试为地图中的用户位置标记添加自定义图标。但图标显示为黑白。
LocationComponentOptions customLocationComponentOptions = LocationComponentOptions.builder(this)
.foregroundDrawable(R.drawable.android)
.build();
// Get an instance of the component
LocationComponent locationComponent = mapboxMap.getLocationComponent();
// Activate with options
locationComponent.activateLocationComponent(
LocationComponentActivationOptions.builder(this, loadedMapStyle)
.locationComponentOptions(customLocationComponentOptions)
.build());
// Enable to make component visible
locationComponent.setLocationComponentEnabled(true);
// Set the component's camera mode
locationComponent.setCameraMode(CameraMode.TRACKING);
// Set the component's render mode
locationComponent.setRenderMode(RenderMode.COMPASS);
我在this question 中尝试了选择的答案,但没有奏效。我尝试使用 jpg 而不是 png,但没有任何改变。
如果我在实际设备上运行它,它可以正常工作。所以我想问题出在模拟器上。
【问题讨论】:
-
正确,这只是模拟器的问题。查看此解决方法 - github.com/mapbox/mapbox-gl-native/issues/…。
-
@ŁukaszPaczos 你能补充一下吗?我想关闭这个问题。
-
好的,刚刚发布。
标签: android mapbox drawable qemu mapbox-android