在Android的另一个图标之上的图标
我正在编码一个类似于Java的Android应用程序(使用Java),我使用Google Maps SKD的两种标记:一个用于我当前的位置,另一个指示我的位置。
我为这些标记设置了两个不同的图标,如何将其中一个给予优先级? 我希望MU当前位置图标标记在所有其他图标标记上显示,我该怎么做?
谢谢您的时间:)
编辑:这是我使用的一些代码,用于我当前的位置标记
Drawable arrowDrawable = getResources().getDrawable(R.drawable.current_position_icon);
BitmapDescriptor arrowIcon = getMarkerIconFromDrawable(arrowDrawable);
Marker currentPositionMarker = gMap.addMarker(new MarkerOptions()
.position(new LatLng(location.getLatitude(), location.getLongitude()))
.draggable(false)
.rotation(location.getBearing())
.icon(arrowIcon)
.flat(true));
,这是我用来设置其他标记的代码
Marker marker = gMap.addMarker(new MarkerOptions()
.position(new LatLng(event.getLatitude(), event.getLongitude()))
.title("Acc. value -> " + Double.toString(event.getAccelerometerValue()))
.icon(potholeIcon)
.draggable(false));
,这是我使用标记的唯一一次,我不使用它我的XML或其他Java代码。
I'm coding an android app (using java) maps-like and I use two kind of markers from Google Maps SKD: one for my current position, the other one indicates me places of intereset.
I set two different icons for these markers, how can I give to one of them the priority?
I want mu current position icon marker to be shown over all other icon markers, how can I do that?
Thank you for time :)
EDIT: here's some code I'm using for my current position marker
Drawable arrowDrawable = getResources().getDrawable(R.drawable.current_position_icon);
BitmapDescriptor arrowIcon = getMarkerIconFromDrawable(arrowDrawable);
Marker currentPositionMarker = gMap.addMarker(new MarkerOptions()
.position(new LatLng(location.getLatitude(), location.getLongitude()))
.draggable(false)
.rotation(location.getBearing())
.icon(arrowIcon)
.flat(true));
And here's some code I'm using to set my other markers
Marker marker = gMap.addMarker(new MarkerOptions()
.position(new LatLng(event.getLatitude(), event.getLongitude()))
.title("Acc. value -> " + Double.toString(event.getAccelerometerValue()))
.icon(potholeIcon)
.draggable(false));
It's the only time where I use my markers, I don't use it im my XML or in other Java code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
渲染其他所有图标后,渲染“当前位置图标”。
如果是XML,请最后添加。
如果是在Java中,则只需声明并将其添加到最后一个布局。
如果您无法提供代码,则无法提供代码...
编辑:
确定我的想法,我将提供一些代码。
XML:
或
Java:
或者,如果您使用的是拖放。
只需最后放置图标即可。
(但是,如果您为确保确定编写编码,那就更好了。)
Render your "current position icon" after you rendered every other icon.
If it's XML then just add it last.
If it's in Java then just declare and add it to the layout last.
Can't provide code if you can't provide code though...
Edit:
Made out my mind, I'll provide some code.
XML:
Or
Java:
Or, if you are using drag-and-drop.
Just drop the icon last.
(But it would be better if you code it instead just to make sure.)