Search code examples
javaandroidimageontouch

Floating image in an activity - android -


I would like to create a picture/button that is displayed over the content of an activity and I can move it anywhere on the screen. Example of functionality: If I move it close to the left side of the screen I would like the image to move to the edge when the user drops the object.


Solution

  • You can either use a draggable view library like DraggableView or you can implement your own onTouch handling to handle touch events for dragging image view. Here's an article for reference.