how to add fixed floating overlay image to google Map in Android - java

I'm trying to add an image overlay that stays at center of the map when you move and get the location of the map. I tried to used marker but they stayed at specific location and also the same with groundoverlay. So I just want an image that stay in the centre of the map view. I have few ideas on how to do it but I'm trying to get the best solution. One of my idea is to use relative layout and overlay the image on top of the MapView but I think this may cause problems. let me what's the best way to do it.

FrameLayout containing both SupportMapFragment (or MapView) and ImageView.
Simplest solutions are always the best.

Related

Straightforward way to place text on a specific location in an image?

Overhead schematic of Docks map in Modern Warfare
Overhead schematic of Docks with one callout name
I'm creating an app that will display names - "callouts" - for various specific areas of each map in the video game Modern Warfare. I want to be able to place the text (or a placeholder) in the same location, regardless of scale, transformations, etc. Is there a way to do this besides getting the (x,y) coordinates of each location in an image editor, then using those coordinates in my layout? That method seems extremely tedious because there's 10 - 20 callouts per map, and approximately 20 maps! I also want to avoid adding the text graphically so that I can change it as necessary in Android Studio.
If I place TextViews visually in the [Design] tab in Android Studio, will they stay in the same position relative to the background ImageView, regardless of scaling, transforms, etc.? Please advise, and I'll be happy to clarify if necessary. Thanks!
I think I've found the solution I'm looking for, folks:
Within a ConstraintLayout, have an ImageView to hold the map graphic, and TextViews for each callout label.
Constrain each TextView to the Start, End, Top, and Bottom of the ImageView.
Drag the TextViews to the desired location in the [Design] tab of the layout editor. This will automatically adjust the Horizontal and Vertical Bias, which is essentially a percentage of the parent's width and height, relative to the left and top of the parent.
In my preliminary testing, this seems to preserve the location of each callout label relative to the map, which is what I was hoping for. If anyone has anything to add, please do so!

Image Scroll in Indoor Positioning System - Android

I am working in Indoor Positioning System .. It will be an android app like this
I am trying to make custom View for displaying the map, First step I make a Scrollable ImageView following article called 'A simple implementation of a scrollable ImageView'
The problem is when I put a marker in the map (using another ImageView for marker), When I start scrolling .. the markers start disappearing like this
So can any one help me ? I want markers to stick into the map and only the map scroll (I mean like Google Maps)
For creating map, Canvas is a better option, in canvas you can implement scroll,zoom,rotation etc.
In canvas it supports any number of bitmaps, and also we can draw programmatically within the canvas.

Android - Zooming Issue on project

I'm working on this project which involves a map with pins on it that populate from a database. The idea was to click on the map and the pin would pull up information, I have all of this working. I position these with a relative layout and the pin inside this.
Where my problem lies is, I have a pinch to zoom and all that on here and when I zoom on the image, my pins stay in their original position. Is there anyway I can have these pins zoom in when the image is zoomed?
Thanks!
I would look into placing the Pins onto the map via an exact location (eg latitude and Longitude) and then the pin always being the same size image this when the map zooms the pin is relative to an exact position there for moving with the image below.
another eg would be locating the pin on pixles 100 right and 50 down.
An implementation of an HTML map like element in an Android View:
Supports images as drawable or bitmap in layout
Allows for a list of area tags in xml
Enables use of cut and paste HTML area tags to a resource xml (ie, the ability to take an HTML map - and image and use it with minimal editing)
Supports panning if the image is larger than the device screen
Supports pinch-zoom
Supports callbacks when an area is tapped.
Supports showing annotations as bubble text and provide callback if the bubble is tapped
try this link you will find your solution https://github.com/catchthecows/AndroidImageMap

dynamically position views (similar to markers in Google Maps) on top of large scrollable + zoomable imageview

i have an imageview containing a bitmap that can be zoomed into and scrolled. i've used the setImageBitmap() method instead of setting the image on a canvas. the imageview acts as a map which the user can browse through. now, my application is supposed to allow the user to marker points of interest with push-pins as done in Google Maps on a point selected on the imageview by the user. i've gotten the ability to pick up which point on the original bitmap was selected using a modified implementation of the OnTouch() method to work so i know where exactly the marker has to be placed.
i want to set a marker to this location and pass a string into a database to store information about the location so that when the marker is tapped, this information is shown in a bubble/toast notification.
as of now, i can scroll the image, sense a longTouch event on the imageview, save point of tap, move to new activity to collect information to add in the database. i can't seem to find a way to set up my markers on the original imageview.
also, i'm guessing i'd have to use an ArrayList implementation here to get markers with individual IDs that could be correlated to the ID in the database fields but i don't understand how to implement that.
i looked around the Internet for a solution or an idea and i've tried many things before posting here but nothing seems to work.
using a canvas' draw functions wouldn't allow for onTap functions to show info notifications. the drawn bitmaps also lose scale and quality while zooming. i tried making a custom class extending RelativeLayout to act an an invisible layer on my imageview but i don't know how to place markers in exact locations and also make the custom RelativeLayout easier. i tried placing a false transparent canvas of the same dimensions as my bitmap to get scaling to work and allow me to place markers at absolute locations but it didn't work. plus, using onTouch events on the custom RelativeLayout class meant i couldn't use the onTouch events on the lower imageview class.
i can't seem to come up with any solutions that can help me implement the mechanism as i want to, so i'm open to any sorta idea that can be thrown at me. i'd appreciate some help.

How to set center of GoogleMap?

I have following task: I have been making Android application, and I need to set drawable marker into center of Map that if I move map or zoom map this marker will continue point to center of Map, won't move with Map. How can I do it?
You can set the center of map by getting the controller of map view and set its center.
mapView.getController().setCenter(GeoPoint);
Why would you even want to use a marker for that? It sounds like the obvious solution is to have another ImageView or ImageButton or what have you layered on top of your map with layout_gravity="center". It'll stay centred and you won't need to constantly move a marker around.

Categories

Resources