How can I use Picasso and Google Marker Custom Icon to achieve this feature?
I know how to use Picasso for the image, but I don't know how to add that "marker icon" on the bottom and the borders.
Picasso.with(mContext)
.load(url)
.resize(250, 250)
.centerInside()
.into(new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
Marker driver_marker = mMap.addMarker(new MarkerOptions()
.position(new LatLng(Double.parseDouble(lat), Double.parseDouble(lng)))
.icon(BitmapDescriptorFactory.fromBitmap(bitmap))
.title(name)
.snippet(address)
);
@Override
public void onBitmapFailed (Drawable errorDrawable){
}
@Override
public void onPrepareLoad (Drawable placeHolderDrawable){
}
});
}
I added this inside the onBitmapLoaded:
Paint paint = new Paint();
paint.setColor(Color.YELLOW);
paint.setStrokeWidth(10);
paint.setShadowLayer(5, 0, 1, Color.RED);
Canvas canvas = new Canvas(bitmap);
canvas.drawLine(0, 0, canvas.getWidth(), 0, paint);
canvas.drawLine(0, 0, 0, canvas.getHeight(), paint);
canvas.drawLine(0, canvas.getHeight(), canvas.getWidth(), canvas.getHeight(), paint);
canvas.drawLine(canvas.getWidth(), 0, canvas.getWidth(), canvas.getHeight(), paint);
And that seems to added the borders, but how do I add that inverted pyramid with the Canvas? Thanks, after that, I'm pretty much done! :D
driver_marker.anchor(0.5f, 0.5f);
see here – Hopple