2

I'm making an app that sets a pin down on a certain location. I would like the location to be at the bottom center of the image. I'm using the setBounds method to create the bound but I'm not sure how to make it "boundCenterBottom"

            drawable = Maps.this.getResources().getDrawable(pincolorstar[ImTracking.pList.get(k).getPosition()]);
  // right now the bounds are putting the marker way off target
            drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
//more stuff

            OverlayItem overlayitem = new OverlayItem(myPoint, mList.get(i).getName(), mList.get(i).getTime());
           overlayitem.setMarker(drawable);
Sean Pan
  • 493
  • 2
  • 6
  • 21
  • http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/ItemizedOverlay.html#boundCenterBottom(android.graphics.drawable.Drawable) – kamil zych Sep 04 '11 at 08:28

1 Answers1

4

I'm not sure this will work and can't check it right now, but try:

int dWidth = drawable.getIntrinsicWidth();
int dHeight = drawable.getIntrinsicHeight();
drawable.setBounds(-dWidth / 2, -dHeight, dWidth / 2, 0);
kamil zych
  • 1,682
  • 13
  • 21