Android: How To: Implement Image Drag And Zoom Extending Imageview Using Multi Touch Capability Of 2.1 Up
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.
Solution 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.
Solution 2:
Call invalidate in ondraw method.
Solution 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 inorout itself
https://github.com/MikeOrtiz/TouchImageViewfromthis 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);
}
returntrue;
}
here both cases I implementing in my app,so definately solve your problem...
Post a Comment for "Android: How To: Implement Image Drag And Zoom Extending Imageview Using Multi Touch Capability Of 2.1 Up"