从绘制在谷歌地图版本2将图像作为标记 [英] Set Image from drawable as marker in Google Map version 2

查看:166
本文介绍了从绘制在谷歌地图版本2将图像作为标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这部分的code添加标记在 MapFragment 在谷歌地图版本2。

I am using this part of code to add a marker in a MapFragment in Google Map Version 2.

MarkerOptions op = new MarkerOptions();
op.position(point)
    .title(Location_ArrayList.get(j).getCity_name())
    .snippet(Location_ArrayList.get(j).getVenue_name())
    .draggable(true);
m = map.addMarker(op); 
markers.add(m);

我想从我的绘制使用不同的图像。任何帮助将AP preciated。

I want to use different images from my drawable. Any help will be appreciated.

推荐答案

这是如何设置的任何可绘制为标记

This is how you can set any drawable as a Marker

BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.current_position_tennis_ball)


            MarkerOptions markerOptions = new MarkerOptions().position(latLng)
                     .title("Current Location")
                     .snippet("Thinking of finding some thing...")
                     .icon(icon);

            mMarker = googleMap.addMarker(markerOptions);

这篇关于从绘制在谷歌地图版本2将图像作为标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆