How to mark a spot over an image in Android?

I would like to know how to mark a spot above the image. The knowledge on the touch screen will have an image to show that a touch was made there. How can I achieve this, any example would be helpful.Thanks

+4
source share
1 answer

In Activity, override the onTouchEvent method from which you can get the Event, and from which you can get full information about the Touch (i.e. X, Y Cordinates, the pressure that the user stores on the screen and even several Touch and many others).

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

Use the code below to make it transparent.

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

Here it is. You will get the desired effect if you work correctly on the code above.

0
source

Source: https://habr.com/ru/post/1388612/


All Articles