Marius
Marius

Reputation: 4016

Android - dragging imageview with finger does not update position

I'm using a frame layout and a top/left margin combination to drag an imageview around the screen. I've added all code in setOnTouchListener() of the imageview. The problem is the UI does not get repainted on MotionEvent.ACTION_MOVE and i only see the update when MotionEvent.ACTION_UP is received. How could i force the view to redraw the image at its new position on MotionEvent.ACTION_MOVE ?

Upvotes: 1

Views: 1047

Answers (1)

TurqMage
TurqMage

Reputation: 3321

You want to invalidate the view. If you can get the ImageView call getParent() then invalidate on the parent and that should force a redraw.

((View)v.getParent()).invalidate();

Upvotes: 1

Related Questions