How to make the bitmap image clickable on canvas in android like a button on click listener?
Asked
Active
Viewed 655 times
1 Answers
1
You cannot set click listeners directly on a Canvas. If your bitmap is being set to an ImageView, you can just set a click listener on it as normal:
imageView.setOnClickListener(view -> {
//do something
})
Otherwise, you can create a custom View
and use your Canvas
in its onDraw()
method. You can then use the onTouch()
method to capture click events.

Orbit
- 2,985
- 9
- 49
- 106
-
Thank u. How to create a movable custom view inside a canvas ? – Monica Feliz Jan 02 '17 at 18:33
-
If you have another question it would be best to post another question with the code you've tried. – Orbit Jan 02 '17 at 18:34