Droid_Dev
Droid_Dev

Reputation: 1162

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?

Upvotes: 16

Views: 1454

Answers (3)

Droid_Dev
Droid_Dev

Reputation: 1162

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);
    } 

Upvotes: 4

giZm0
giZm0

Reputation: 1511

We implemented a simulare behavior but we derived from ViewGroup and made most of the code by ourself. We also had to use android.support.v4.view to make it work for 2.2

Upvotes: 1

Ivan Bartsov
Ivan Bartsov

Reputation: 21056

Check out this library: android-dragarea

Upvotes: 1

Related Questions