Monday, March 14, 2011

[android-developers] Re: Locate Zoom Controls (x,y) in MapView?

I highly suggest just implementing your own ZoomControls as an
"appropriate" alternative. You can add a ZoomControls element to your
layout, place it wherever you want, and have much more control over
it, without having to do a lot of hackery around the built-in variety
(just set it to not use built-in). The only things you may need to do
are handle touch events to determine when you want them to appear/
disappear automatically, and handle their actions. I think it's
generally been found that to do anything complex with MapViews, the
built-in items are best left as proof-of-concept examples (such as the
my location overlay), to base your own more customized versions off
of.

On Mar 14, 10:44 am, mcmatom <mcmatom.testa...@gmail.com> wrote:
> UPDATE:  I have managed to get this working, but it still has a "hacky" feel
> to me since it is completely reliant on the placement of the zoom controls
> forever being at the bottom of the screen.  I am open to any suggestions on
> how to handle this more appropriately.  For anyone interested, the code
> snippet placed into *OnSingleTapUpConfirmed* follows:
>
>     ZoomButtonsController zBC = mView.getZoomButtonsController();
>     View zcView = zBC.getZoomControls();
>
>     int iMapHeight = mView.getHeight();
>
>     Rect zoomHit = new Rect();
>     zcView.getHitRect(zoomHit);
>
>     zoomHit.top = iMapHeight - zcView.getHeight();
>     zoomHit.bottom = iMapHeight;
>
>     RectF rectFloat = new RectF(zoomHit);
>     if (rectFloat.contains(e.getX(),e.getY())) {
>         return false;
>     }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment