Image Scroll in Indoor Positioning System - Android - java

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.

Related

layout background pattern

I would like to know if it is possible create this in android studio for
layout background of my activity.
Reapet a drawable and move in a direction.
You can try adding this dependency to add gif animation:
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25'
and use FrameLayout.
As an alternative, consider the using the MotionLayout widget to manage motion and widget animation.
This can be done in many ways:
Animated Vector Drawable as the android:background
Animated Gif
Object Animators
MotionLayout
1
There is many ways to create this.
The most elegant and efficient solution is an an animated vector drawable.
But it is also difficult to get all the information together to do it.
2 This Gif will be big or blurry and a resource hog. but simple to implement
3 ObjectAnimator straightforward create a collect of (about 6)black views , rotate 45 degrees
and use a series of ObjectAnimators to translateX/Y
4 MotionLayout would allow this without code and mostly in studio
Create A Constraint Layout
drag 6 black views, rotate and Position them using the Attributes
Convert to MotionLayout
In the "End" ConstraintSet Modify TranslationX & TranslationY
Set Transition to AutoStart
Create A Transition to AutoJump back to the end.

Android view with multiple random animation instances

So, I'm working on a main menu activity for my android application.
I want to create background animation where there are things translating from the top of the screen to the bottom. The x position and translation speed of each will be random (within some limits).
I have created a new thread to run this animation (so the UI doesn't get slow or messed up).
I do not want to use a SurfaceView if possible. I'm planning on using an ImageView resource, then using .startAnimation(animation), where animation is a translational animation resource.
My problem:
Is it possible for me to create multiple instances of the same ImageView, if I wanted to run multiple animations at the same time (3 of the same ImageViews falling at different rates and different x positions)?
How do I set the starting point of each of the ImageViews to be at some specific x position? For me to specify an absolute starting point, which type of layout would be required?
Any help is appreciated.
I think I've just decided that a linear layout placed on top of a surface view is the best option. The animation would just be drawn on the surface view while the regular menu interface is contained in the linear layout.
Update:
Used a FrameLayout with a SurfaceView and LinearLayout inside. It works perfectly.

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

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.

How to get an image from drawables onto canvas via interaction

I have created a canvas on android which has a circle drawn on and buttons however I want an image from the drawables to be dropped in via some sort of interaction so I thought of using a button, but I have created this screen only using the content view of the java class, thus I cannot use xml so is there any way you guys would know how I can grab the image on click in java (programatically).
Thanks.
you can draw anything on canvas,and add events to custom class that you have designed...
take a look http://android-er.blogspot.in/2010/05/draw-bitmap-on-view.html

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.

Categories

Resources