最近有一个需求,是一个出行类的App,需要在乘客下单后在地图上显示乘客的头像以及司机的头像。
这时候就需要在地图上插上一个marker
ImageLoader.loadLisenter(mContext,headUrl,
imageView);
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory
.fromView(imageView1);
LatLng latLng = new LatLng(lat,lon);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.setFlat(true);
//设置覆盖物比例
markerOptions.anchor(0.5f, 0.5f);
markerOptions.icon(bitmapDescriptor);
markerOptions.position(latLng);
Marker marker = mAmap.addMarker(markerOptions);
marker.setClickable(false);
在ImageLoader封装的这个工具类中,添加了一个接口,在外部调用接口回调,得到加载完成的Resouce。
这个Resouce是GlideDrawable的对象,可以调用getCurrent();方法,得到Drawable对象,从而进行imageView的资源设置
@Override
public void accomplish(Drawable drawable, ImageView imageView) {