1
是否可以使用android中的任何图像库在图像上添加标记?使用毕加索在图像中添加标记
到目前为止我已经使用picasso将图像加载到ImageView中,并且我使用Google的所有解决方案都在Google地图中添加标记!
Just Like the marker center in the image
是否可以使用android中的任何图像库在图像上添加标记?使用毕加索在图像中添加标记
到目前为止我已经使用picasso将图像加载到ImageView中,并且我使用Google的所有解决方案都在Google地图中添加标记!
Just Like the marker center in the image
毕加索提供了可用于实现自己的图像目的地的通用目标接口。具体来说,你会想要覆盖onBitmapLoaded来填充你的标记。
基本实现如下。
public class PicassoMarker implements Target {
Marker mMarker;
PicassoMarker(Marker marker) {
mMarker = marker;
}
@Override
public int hashCode() {
return mMarker.hashCode();
}
@Override
public boolean equals(Object o) {
if(o instanceof PicassoMarker) {
Marker marker = ((PicassoMarker) o).mMarker;
return mMarker.equals(marker);
} else {
return false;
}
}
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
mMarker.setIcon(BitmapDescriptorFactory.fromBitmap(bitmap));
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}}
你会使用这样的:
marker = new PicassoMarker(myMarker);
Picasso.with(MainActivity.this).load(URL).into(marker);
看到这个:HTTP://stackoverflow.com/questions/27095469/how-can-i-use-picasso-to-add-icon到标记 – rafsanahmad007
它似乎是GoogleMaps的代码 上述链接中给出的代码也不起作用 – user1809029