【发布时间】:2015-06-17 11:46:26
【问题描述】:
ImageView currentImage = (ImageView) findViewById(R.id.image) ;
onTouch(View v, MotionEvent event){
if(event.getAction() == MotionEvent.ACTION_DOWN){
float x = event.getX() ;
float y = event.getY();
currentImage.setX(x) ;
currentImage.setY(y) ;
//the 2 lines above must be dragging the image across the screen
}
if( event.getAction() == MotionEvent.ACTION_UP){
currentImage.setX(x) ;
currentImage.setY(y) ;
}
}
但是,代码不起作用,这是我能想到的最接近的。
【问题讨论】:
-
您找到解决方案了吗?
标签: android view drag-and-drop motionevent