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.
Related
So here's the tricky or buggy thing.
I have an activity that displays a mapview (I don't believe this is important at all, but the mapview is from Carto Mobile SDK), and I have a few actions that trigger two fragments to be displayed over the current activity layout.
The first one, takes the whole screen and is fully interactive. There is a Toolbar, a few Spinners and some TextViews.
The second fragment that gets displayed, takes a portion of the screen (almost the lower half), and the elements I included are interactive (3 Image Buttons). However, if I click over a part of that layout that's on the lower half of the screen, that has a white background, is like it's 'invisible' to the touch event.
Let me rephrase it. There's a white box, that if I touch over it and I perform a movement, like if I was moving the map (the mapview behind it, which I can partially see), I can then see the map moving. Even though I'm seeing the white LinearLayout, with 3 Image Buttons in it, if I click somewhere where there isn't any of the Image Buttons, is like the LinearLayout isn't there and the map moves.
I attached a screenshot at the end. The area that I talk about is just on top of the Image Buttons (Route to, Route from and View details).
Can I stop that from happening? Is this due to Carto or is an Android thing?
You don't put any code above so I assume your root view doesn't have click event, only the 3 buttons have.
Add clickable="true" to your white panel's root view to capture all the touch event
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.
I have searched a lot but I couldn't find an answer.
I want to implement something like in Go Launcher. When you drag an icon in app drawer and move it out of container top or bottom bound, the list begins to scroll.
So far, I have tried following things:
Dispatch touch events to simulate scrolling - impossible while touching the screen
Use smoothScrollBy() method - almost there, but it scrolls only screen height distance
Use scrollBy() - it moves only the container and leaves blank space. I would put there some rows if only I could be able to reuse views that went off the screen.
I need the ListView to scroll SMOOTHLY.
So here goes ma question. Anybody knows how can it be done? I'll put a gratitude in About section of my app to person who will help me:)
using listview and try scrollToPosition(),or smoothscrollBy()
I want to create an Android application that has a MapView at the top of the screen and a horizontal scroll view at the bottom. The data that are going to be shown on the map should be displayed at the bottom scroll view(horizontal scroll view).
Data that are current being displayed at the bottom of the scroll view will be displayed on the map as a pin. So if users scroll the bottom scroll view then the pins(represent the data on the map) will be changed associate with the data from the bottom scroll view.
I have a background with iPhone development and I am a kinda newbie for Android. Any tutorials or samples that might help for this case? Thanks in advance.
Start with the android google map tutorial.
It will explain you how to deal with maps and markers
and this one for a similar design with buttons
And in order to draw buttons on a mapview, you have to use this trick.
You will already be on the right track.
And for the list (use a list view in android), it depends where your data are from, use either a cursorAdapter (database) or arrayAdapter (memory data).
Regards,
Stéphane
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.