【问题标题】:Adding custom location icon in mapbox - Image appears black and white在地图框中添加自定义位置图标 - 图像显示为黑白
【发布时间】: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,但没有任何改变。

如果我在实际设备上运行它,它可以正常工作。所以我想问题出在模拟器上。

【问题讨论】:

标签: android mapbox drawable qemu mapbox-android


【解决方案1】:

正确,这只是模拟器的问题。查看此解决方法 - https://github.com/mapbox/mapbox-gl-native/issues/10829#issuecomment-441021598

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-02
    • 1970-01-01
    • 2023-03-19
    • 2021-01-08
    • 1970-01-01
    相关资源
    最近更新 更多