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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…