从Eclipse Android中的Drawable文件夹中更改标记图标

时间:2014-06-29 05:10:13

标签: android maps marker

我的代码出了问题,我不知道它出了什么问题。 这是:

mMap.addMarker(new MarkerOptions()
    .position(new LatLng(14.590230, 120.983149))
    .title("SM City Manila"))
    .icon(BitmapDescriptorFactory
    .fromResource(R.drawable.blue));

问题出在第4行,其中错误打印:The method icon(BitmapDescriptor) is undefined for the type Marker.

1 个答案:

答案 0 :(得分:1)

试试这个。

 private static final LatLng MyPlace = new LatLng(14.590230, 120.983149);
              private Marker melbourne = mMap.addMarker(new MarkerOptions()
                                        .position(MyPlace)
                                        .title("SM City Manila")                                                      
                                        .icon(BitmapDescriptorFactory.fromResource(R.drawable.blue)));
相关问题