Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to place pin mark image over an image in android?

I am new to Android. I am developing a project where I will get the Radio signal values(I can get the values from API). I have a floor plan. The floor plan has kitchen,hall,bedroom sections.. If I click the Kitchen section, I need to place an Pin Image in that section with Radio signal values. Once I click Save, I need to lock the Image(with values) in that particular section. Similarly I can place many Pin images based on the requirement.

Please give me some related link or sample codes to develop this. I have attached the Image for your reference. Any help would be really appreciated.

enter image description here

like image 772
reegan29 Avatar asked Mar 12 '15 15:03

reegan29


People also ask

How do you mark a spot on a picture?

Screen Master makes it easy to annotate photos on Android. Take an Android screenshot of what you want to highlight, then tap Edit. Along the bottom, scroll to the right until you find Spotlight, then tap on it. Find a shape that you'd like to use for highlighting at the bottom and tap it.

What is image view in android?

ImageView class is used to display any kind of image resource in the android application either it can be android. graphics. Bitmap or android. graphics. drawable.


2 Answers

One way to do this would be to use canvas.

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    Bitmap map = BitmapFactory.decodeResource(getResources(), R.drawable.map);
    canvas.drawBitmap(map, xPositionForMap, yPositionForMap, null);

    Bitmap marker = BitmapFactory.decodeResource(getResources(), R.drawable.marker);
    canvas.drawBitmap(marker, xPositionFor1stMarker, yPositionFor1stMarker, null);
    canvas.drawBitmap(marker, xPositionFor2ndMarker, yPositionFor2ndMarker, null);
}

Things drawn later in the onDraw appear on top of those drawn earlier. Probably the BitmapFactory.decodeResource should be in a create/init mat hod so they aren't called every time onDraw is called. See http://developer.android.com/training/custom-views/custom-drawing.html for more information.

For clicking on the pins you would catch clicks on the Layout containing the canvas and conditionally add extra drawables and text.

An alternative way is to use RelativeLayout and put ImageView, which would work similarly.

like image 161
TTransmit Avatar answered Sep 30 '22 18:09

TTransmit


Have a look on this library, may be this will help you ImageLayout

like image 43
Vishal Makasana Avatar answered Sep 30 '22 16:09

Vishal Makasana