Karthik
Karthik

Reputation: 5033

How to mark a spot over an image in android?

I would like to know how to mark a spot over an image.Marking would be on the touch of the screen would have an image to show that touch has been made over there.How can I achieve this, any example would be helpful.Thanks

Upvotes: 4

Views: 2656

Answers (1)

Pavandroid
Pavandroid

Reputation: 1586

In Activity override onTouchEvent method from which you can get the Event and from which you can get the complete information about the Touch (i.e., X, Y Cordinates, Pressure that user kept on the screen and even multiple Touch and many more).

Take the ImageView and override onDraw and draw the desired image at (X,Y) coordinates. Just use a small Loop to make it invisible continuously which looks like a haptic feedback.

Use the below code to make it transparent

ImageView myImage = (ImageView) findViewById(R.id.myImage);
myImage.setAlpha(127);

Thats it. You will get the desired effect if you properly worked on the above code.

Upvotes: 1

Related Questions