android - How does one drag an image form one layout to another layout -


how 1 drag image 1 layout layout. attaching have done far. have 2 layouts in single view. can move image on initial layout. problem cant move image different layout. please me find solution problem.

    <?xml version="1.0" encoding="utf-8"?>  <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"         android:orientation="vertical"         android:layout_width="fill_parent"         android:layout_height="fill_parent">   <linearlayout         android:orientation="vertical"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:layout_weight="1">         <imageview          android:id="@+id/imageview"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:src="@drawable/icon"         android:scaletype="matrix"          android:layout_weight="1">         </imageview>          <imageview          android:id="@+id/imageview2"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:src="@drawable/icon"         android:scaletype="matrix"          android:layout_weight="1"         android:background="#00aa00"         >         </imageview>              </linearlayout>      </linearlayout> 

and main file is

package com.example.multitouch; import android.app.activity; import android.graphics.matrix; import android.os.bundle; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.widget.imageview;  public class multitouch extends activity  implements ontouchlistener{      /** called when activity first created. */     matrix matrix = new matrix() ;     matrix eventmatrix = new matrix();     static float centerx,centery;     final static int none = 0;     final static int drag = 1;     int touchstate=none;       @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);         imageview view = (imageview) findviewbyid(r.id.imageview);         view.setontouchlistener(this);           }      @override     public boolean ontouch(view v, motionevent event) {         // todo auto-generated method stub         imageview view = (imageview) v;         final int action = event.getaction();           switch(action){         case motionevent.action_down:             touchstate= drag;             centerx= event.getx();             centery = event.gety();                      eventmatrix.set(matrix);                         break;               case motionevent.action_move:             if (touchstate == drag) {             matrix.set(eventmatrix);             matrix.settranslate(event.getx()-centerx,event.gety()-centery);             }                        view.setimagematrix(matrix);             //view.setimagematrix(eventmatrix);         break;           case motionevent.action_up:             //touchstate=none;             break;          }                return true;     } } 

please give me reply

it can complicated, check out: http://blahti.wordpress.com/2011/02/10/moving-views-part-3/


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -