问题
I have this kind of behavior when I drag or zoom the image.
If you have noticed, the image seems left the previous state during dragging. Any inputs are appreciated.
回答1:
Please try to build the following a project.
https://github.com/gabu/AndroidSDK-RecipeBook/tree/master/Recipe060
This project is Running fine on Nexus S/Android 2.3.4
Please compare the your code and this project.
回答2:
Call invalidate in ondraw method.
回答3:
Try this,
I have a very sucessive solution for you,i m very sure that it will work for you,
try to use TouchImageView instead of ImageView in Layout.because touchimageview have property that zooming in or out itself
https://github.com/MikeOrtiz/TouchImageView
from this link you learn how to use touchimageview...
Then After implement onDragListener of TouchImageView so you can get DRAG And Drop of Imageview easily...
@Override
public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) {
case DragEvent.ACTION_DROP:
TouchImageView target = (TouchImageView) v;
TouchImageView dragged = (TouchImageView) event.getLocalState();
Drawable target_draw = target.getDrawable();
Drawable dragged_draw = dragged.getDrawable();
dragged.setImageDrawable(target_draw);
target.setImageDrawable(dragged_draw);
}
return true;
}
here both cases I implementing in my app,so definately solve your problem...
来源:https://stackoverflow.com/questions/7356031/android-how-to-implement-image-drag-and-zoom-extending-imageview-using-multi-t