Is there anything like an itemized Overlay for Images? - android

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.

Related

Putting a button on top of an imageView

So here is my problem. I've spent couple of days on this and didn't get anywhere. I've tried every layout possible, but it just doesn't seem to work.
Basically, I have a map of a floor and I want to make it so when you click on different parts of that floor, a new activity or a dialog box shows up. I want this to scale for all the devices. Why is this so difficult in Android? I would think that putting buttons on top of an image would be easy and made sure that it wouldn't move like in HTML.
I have been looking into Surface View, but wasn't sure if that's the best way to go? I can get the coordinates of the objects on the floor, would that help?
I want to implement this inside of an fragment. Thanks!
One possible solution could be to have a RelativeLayout as the base layout of your 'Floor Map' fragment, with the floor image set as its background.
Then you could add buttons or any other views to the Relativelayout at the coordinates of the objects.
If you already know how many features the floor will have, you could add the buttons statically, otherwise, loop through your array of features to add them dynamically.

how to use parallel scrolling in android with two views

I am trying to use parallel scrolling in android.i.e.i have two view in a layout a mapview on the top and a listview in the bottom.when i scroll up in the listview, the mapview should also scrollup.as we keep scrolling the list should cover the whole screen.
i have tried getting the cordinates of the listview using the ViewTreeObserver.onGlobalLayoutListenerand
moving the listview on touch,which is not working out. can i get any suggestions on how to proceed.
Edit: I managed to get desired effect using parallaxScrollview. But how do i make the backGround image clickable in parallaxscrollview
You'll have to register for the onTouch of the listView and dynamically change the position and the size of the two components with every variation on the Y axis

Android UI help

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

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.

MapView with ItemizedOverlay and map scrolling

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".

Categories

Resources