如何设置MarkerOptions对象的图标属性?

时间:2016-07-11 12:25:41

标签: android google-maps google-maps-markers

目前,我正在尝试将自定义drawable设置为我的GoogleMap标记但是我收到以下错误:

java.lang.NullPointerException                                                                                              
at maps.f.g.a(Unknown Source)
at maps.af.g$a.<init>(Unknown Source)
at maps.af.g.a(Unknown Source)
at maps.af.R.<init>(Unknown Source)
at maps.af.t.a(Unknown Source)
at vl.onTransact(:com.google.android.gms.DynamiteModulesB:167)
at android.os.Binder.transact(Binder.java:387)
at com.google.android.gms.maps.internal.IGoogleMapDelegate$zza$zza.addMarker(Unknown Source)
at com.google.android.gms.maps.GoogleMap.addMarker(Unknown Source)
at xdesign.georgi.prototyping_espc_streetview.fragments.MapFragment.onMapReady(MapFragment.java:53)
at com.google.android.gms.maps.SupportMapFragment$zza$1.zza(Unknown Source)

这是我正在做的事情:

public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney, Australia, and move the camera.


    mMap.addMarker(new MarkerOptions().position(xDesign).title("xDesign in Edinburgh").icon(BitmapDescriptorFactory.fromResource(R.drawable.circle_drawable)));
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(xDesign,15));
}

我的可绘制XML:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">

    <solid
        android:color="#0093e8"/>

    <size
        android:width="120dp"
        android:height="120dp"/>
</shape>

0 个答案:

没有答案