Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag and Drop Layout in android 2.2

Is it possible to add a layout in a gestureOverlay view and Drag Drop it in a desired position in android. I am able to add a layout but not able to drag and drop it..I want to know is it possible to do this in version 2.2?

like image 713
Droid_Dev Avatar asked Jun 29 '12 06:06

Droid_Dev


People also ask

How do I add drag and drop to Android?

After the user releases the drag shadow, and after the system sends out (if necessary) a drag event with action type ACTION_DROP , the system sends a drag event with action type ACTION_DRAG_ENDED to indicate that the drag and drop operation is over. This is done regardless of where the user released the drag shadow.

Does Android have drag and drop?

Android's drag-and-drop framework lets users move data and views using graphical gestures. Users can drag and drop data across views within the same app or even from one app to another, if they have multi-window mode enabled.

How do I drag and drop on Android tablet?

A double tap and hold allows you to grab and then drag. A two-finger tap acts as a right click. A two-finger drag reproduces the mouse wheel scrolling action.


2 Answers

thanks for the help... myself found a solution for this problem... i couldn't implement a drag on this layout, But i adjust in such a way that the layout will come into the position where i touch on the screen... thanks....

private void RunAnimations(MotionEvent event) {

        lastX = event.getX();
        lastY = event.getY();
        Animation b = new TranslateAnimation(Animation.ABSOLUTE,lastX,Animation.ABSOLUTE,event.getX(),Animation.ABSOLUTE,lastY-57,Animation.ABSOLUTE,event.getY()-57);             
        rl.startAnimation(b);  
        b.setFillAfter(true);
    } 
like image 179
Droid_Dev Avatar answered Sep 29 '22 00:09

Droid_Dev


Check out this library: android-dragarea

like image 35
Ivan Bartsov Avatar answered Sep 29 '22 01:09

Ivan Bartsov