Commit 80405b29a30d07c955e6cee0a9e4aa13a361242d
1 parent
e357efc5
新增marker默认图标
Showing
1 changed file
with
3 additions
and
2 deletions
lib/android/src/main/java/cn/feewee/amap3d/map_view/Marker.kt
... | ... | @@ -6,6 +6,7 @@ import android.graphics.Canvas |
6 | 6 | import android.os.Handler |
7 | 7 | import android.os.Looper |
8 | 8 | import android.view.View |
9 | +import cn.feewee.amap3d.R | |
9 | 10 | import com.amap.api.maps.AMap |
10 | 11 | import com.amap.api.maps.model.* |
11 | 12 | import com.amap.api.maps.model.Marker |
... | ... | @@ -15,7 +16,7 @@ import cn.feewee.amap3d.fetchImage |
15 | 16 | |
16 | 17 | class Marker(context: Context) : ReactViewGroup(context), Overlay { |
17 | 18 | private var view: View? = null |
18 | - private var icon: BitmapDescriptor? = BitmapDescriptorFactory.fromResource(R.drawable.cqfw_amap_location) | |
19 | + private var icon: BitmapDescriptor? = null | |
19 | 20 | private var anchorX: Float = 0.5f |
20 | 21 | private var anchorY: Float = 1f |
21 | 22 | var marker: Marker? = null |
... | ... | @@ -86,7 +87,7 @@ class Marker(context: Context) : ReactViewGroup(context), Overlay { |
86 | 87 | marker = map.addMarker( |
87 | 88 | MarkerOptions() |
88 | 89 | .setFlat(flat) |
89 | - .icon(icon) | |
90 | + .icon(icon?:BitmapDescriptorFactory.fromResource(R.drawable.cqfw_amap_location)) | |
90 | 91 | .alpha(opacity) |
91 | 92 | .draggable(draggable) |
92 | 93 | .position(position) | ... | ... |