0

I am trying to move an imageview based on the the screen onTouchEvent . I am wondering which one to use to move the image view as I am dragging it:

1- Using Layoutparams, set params.leftMargine and params.topMargin

2- Using set setLeft() and setTop() Method on the view

3- Using setX() and setY() method on the view

And any reason to why one would be used not used? Thanks

Snake
  • 14,228
  • 27
  • 117
  • 250
  • instead of moving an ImageView draw the Bitmap directly using Canvas.drawBitmap – pskink Jan 02 '15 at 17:02
  • How about [TranslateAnimation](http://developer.android.com/reference/android/view/animation/TranslateAnimation.html)? – Hemanth Jan 02 '15 at 18:22
  • Pskink, but the image view is loaded already. I don't need to decode to bitmap again. What difference would it make? – Snake Jan 02 '15 at 20:22
  • Arol_123, translate animation does not move the actual image (ie change the coordinates), it just offset the actual drawing – Snake Jan 02 '15 at 20:23
  • 1
    @Snake see one of my answers on how easily you can not only drag the `Bitmap` but also resize and rotate it: http://stackoverflow.com/questions/21633545/android-imageview-scaling-and-translating-issue/21657145#21657145 – pskink Jan 02 '15 at 20:36
  • Thank you for the link. The code is amazing. I upvoted it and placed it favourite :) – Snake Jan 03 '15 at 07:20
  • Easy, huh? But still 95% guys here try to move an ImageView thinking its easier... – pskink Jan 03 '15 at 11:25
  • Hehe. Yes I have to admit I was one of them. Can you please check my newest question which is released in way to this topic? – Snake Jan 04 '15 at 00:02
  • @Snake which question? "Which way to use to draw circle..." or "Draw segmented circle..." ? – pskink Jan 04 '15 at 05:11
  • Oh sorry about that. I am referring to the which way to draw a circle – Snake Jan 04 '15 at 06:20

1 Answers1

0

The first and most important, the android vertion. as a person with 2.3 vertion i know that it s*cks to not be able to use application because my vertion is not compatable.

the setX and setY are able from api 14 if i am not wrong and so is the setLeft and setTop.

only the layoutParams are able from api 1, si it is the best way, in my opinion