Question

I am doing an android app, I want to drag an image and place it on top of a SeekBar at some particular location and correspondingly when the progress of the SeekBar or the thumb collides with the image location I want to play a song, for this to happen I guess I would have to track the location of the thumb on x and y coordinates, can this be achieved? Is there some other way to go around?

Was it helpful?

Solution

  1. You should do the things in the onThouchEvent which has a ACTION_MOVE event.
  2. There are some useful method you can use : getHitRect which can get the rect of the view so that you can use Rect.contains(int x,int y) to get whether the view is in the specified loacation, getLocationOnScreen can help you get the absolute position of the view in the screen so that all the point you get is in the same coordinate system.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top