views:

118

answers:

1

So I have an ImageView sitting on a FrameLayout. I want to move this image view when user taps on it and drags it somewhere. This is what I tried to do:

FrameLayout.LayoutParameters params = new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);

params.setMargin(marginLeft, marginTop, 0, 0); view.setLayoutParams(params);

This does not work however. The imageView does not move. Do I need to refresh the view somehow after I set new layout parameters?

A: 

try view.invalidate(); to get it to draw your updated view.

Cpt.Ohlund
I have tried it, it didn't work
Klimov Ilya