Reputation: 28162
So I have a customoverlay which extend itemizedoverlay in order to place a marker on the map. My problem is that I'd like to adjust the marker so the drawable's bounds are different from the boundCenterBottm and boundCenter values (in my case I'd like to have something like boundLeftBottom if it existed). How do I achieve this? The reason I want to achieve this is because I have a drawable which points down to the left bottom corner.
I've searched the web dry, any help is greatly appreciated.
Suggesting making even transparent space to the left side will not be accepted. I consider this an improper workaround
Edit;
I ended up with this:
public class CustomOverlay extends ItemizedOverlay<CustomOverlayItem> {
private ArrayList<CustomOverlayItem> mOverlays = new ArrayList<CustomOverlayItem>();
private Context mContext;
public CustomOverlay(Drawable defaultMarker, Context context) {
// super(boundCenterBottom(defaultMarker));
super(defaultMarker);
defaultMarker.setBounds(0, -defaultMarker.getIntrinsicHeight(), defaultMarker.getIntrinsicWidth(), 0); //TODO experiment
mContext = context;
}
This is correct though it didn't fix my problem due to the grafic not being perfect in the corner and with 3 different drawables that would be a pain to fix (so final solution is that I'm going to fix the drawable).
Upvotes: 2
Views: 1486
Reputation: 10938
boundCenterBottom and boundCenter are helper functions that call setBounds on the drawable... You can just call that yourself.
For bottom left, I think it will look something like this:
drawable.setBounds(0, -drawable.getIntrinsicHeight(), drawable.getIntrinsicWidth(), 0);
But that was just off the top of my head.
Upvotes: 3