3

i want to implement drag and drop feature but the device version is 2.2.1 so application is not working i am use onTouch method and set coordinate using setx() and setY() but this method is not working on my device version please tell me the alternet way to implement this thanks in advance

  • you might wanna check layoutparams out. i think thats the way to do it: http://stackoverflow.com/questions/2965662/how-do-you-setlayoutparams-for-an-imageview – Ostkontentitan May 14 '12 at 10:49
  • setX and setY are only supported above api 11. – Tarun May 14 '12 at 11:05
  • similar type of question solved at http://stackoverflow.com/questions/12195768/android-use-of-view-setx-and-sety-in-api-8/12195999#12195999 – manojmore Aug 30 '12 at 12:36

3 Answers3

1

Unfortunatelly Android Support Package doesn't contain new Drag-n-Drop from API 11 (Android 3.0) probably because it would need platform-side changes.

Basically you can find examples in Android 2.1 source code for Launcher. But it's a bit complicated. Checkout this implementation of custom ListView component with drag-n-drop. It helped me a lot when I had the same task.

Andrey Ermakov
  • 3,298
  • 1
  • 25
  • 46
  • thanks i have completed this for API below 11 we can use Layout param its working fine –  Aug 31 '12 at 05:25
0

Use this jar file to use functions of all versions up to version 4.

http://www.java2s.com/Code/Jar/a/Downloadandroidsupportv4jar.htm

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Nikhil Lamba
  • 593
  • 1
  • 6
  • 17
0

Android does not support this method in version < 3.0 but if you want to implement this then you need to change the layout param .

Hope this will work you

Alok Tiwari
  • 607
  • 2
  • 7
  • 21