MapView with ItemizedOverlay and map scrolling - android

I have a problem with custom ItemizedOverlay on the MapView in Android.
What I've done: Very simple offspring of ItemizedOverlay class that only wraps my own type of items and uses ItemizedOverlay for all the hard work.
What works: Nearly everything - items are drawn properly, I can tap them etc.
The problem: If I drag the map in the view by the map itself, I can scroll it without a problems. But if I try to start moving the map over one of items from my overlay (eg. "dragging map by item"), it doesn't move.
This is really problem, because if I have "a bit more" items, there is no way to drag the map (without un-zooming and grabbing map outside items).
This problem occurs even if I don't handle any events generated by ItemizedOverlay (eg. with onTap() commented out in my overlay).
Any advice would be appreciated.

OK, we solved this issue.
But only solution we found was writing our own version of "ItemizedOverlay" (without inheriting it). Eg. we're drawing our own overlay and we handle "tap events".

Related

OverLay animation in google map

I'm doing my own MyLocationOverlay implementation to bypass extremely slow current position display.
The problem that I've is that I want to make a little animation changing the color of the position marker and the only way I know to redraw is to call invalidate o MapView. But that way I also invalidate all the other overlays. Is there an efficient way if only I want to change color and other overlays don't need redraw?
AFAIK there isn't.
All overlays are drawing to the same object, so to redraw one, it requires clearing everything, and redraw all of them again.
Even if you add another view to the same layout where is MapView, changing that view will result in MapView.invalidate() being called.
Regards.

adding view on top of googlemap android

I want to have 2 views. My first one will be a GoogleMap and then in the four corners I want to add some graphics. I want when the users moves the map the images to stay in the four corners. I coouldn't find any tutorials on that and I do not know where to start searching so if you have any links or any proposal on what to do, inform me and I will come back with code.
extend the MapView class and override the dispatchDraw() method.
It gives you a canvas and you can draw on it as you please. Afterwards just send it to super() and you have what you want.
Propably you could use an overlay class. You can find many tutorials on overlay with Google. And just position the images like you want.

nutiteq map: Strange map touch behaves in ScrollView container

I'm using nutiteq map. I have made a sample app using this map and it works all right.
But when I put map into ScrollView container then it behaves a strange way like when I touch map for navigate, it is unexpectedly zoom out and zoom in and all that.
It is only happen when I put map into scrollview container. In another view it works all right.
I want to use it with scrollview container but I can't because of this issue.
ScrollView has some special touch events and states (like Cancel touch) which were not handled in earlier versions, but are handled if you take the latest version.
Another issue of ScrollView what you may get is that scrolling is canceled after some panning, as View/Layout controller thinks that user wants to scroll whole view, so MapView does not get necessary events, it just gets Touch cancel. Maybe this can be resolved with Android view parameters.

Navigation controls on a mapview

Im asking a question here without any code because I don't even know if its possible. I have a MapView on an Android application which fills the width of its parent layout but not the height because the map displays a few overlays of locations and then below is a list of the locations and the user can select the one they want or to add a new location to the database. So it goes like this:
Scroll View
LinerLayout
Map View
Text View (of the overlay names on map)
/LinearLayout
/Scroll View
The problem here is that when I try to navigate north and south on the map it just scrolls with the scroll view. I expected it to move the map and only the scroll view if I clicked outside the map. It moves left and right as expected.
So what I was wondering was is it possible to either have some sort of lock function on the map so when you click on it you can navigate around it fine and then click else where on the screen and then you will navigate up and down using the scroll view. Or is there someway to have the up down left and right arrows on the map like the standard google maps do?
(I can navigate around the map fine if I use the roller ball (using the G1 phone) but it is incredibly slow)
Hope this makes sense
Do not put a MapView in a ScrollView. It simply does not work, as you are discovering. Do not put anything that knows how to vertically scroll (MapView, ListView, WebView) in a ScrollView.
Or is there someway to have the up down left and right arrows on the map like the standard google maps do?
You are welcome to create something, but there is no built-in capability for this.

Is there anything like an itemized Overlay for Images?

Hi
I am searching for functionality which works like the itemizedOverlay on the mapview, only for Imageview. So that I can add items on specific locations on the image and trigger actions on tap of the item.
I am building an application for Android where you get Floorplans and on this Floorplan the rooms should be marked and clickable to get more information.
Thank you very much for any help or hint in this matter
Use a RelativeLayout or FrameLayout. Both support Z-axis ordering -- later children will appear to float over top of earlier children. Use setOnClickListener() to be notified of taps on the items.

Categories

Resources