开发者

How do I move and Image View while program is running

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.set开发者_C百科LayoutParams(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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜