1

I have this kind of behavior when I drag or zoom the image.

enter image description here

If you have noticed, the image seems left the previous state during dragging. Any inputs are appreciated.

eros
  • 4,946
  • 18
  • 53
  • 78

3 Answers3

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.

  • i did copy and paste then add the some layout. If you need more information, let me know. I will post here. – eros Sep 09 '11 at 08:42
  • When I created a new project for Recipe060 only, it is running as expected. But when I include it into my project, the same problem occurred. Any idea on what part of configuration do I need to check. – eros Sep 09 '11 at 10:22
  • Yes I would, But for now..would you suggest hints where do I made mistake for these scenarios: (1) I tried to separate the above Activity and create new project just for that Activty. Result was OK. (2) I returned the above activity to my project but disabling my background service. I was supprised, it was running as expected. Result was OK. Conclusion: my background services are getting data by url request and getting coordinates from my location provider. Then, set to my global variables that utilizing by the above Activity to update the current location on the Map. – eros Sep 12 '11 at 00:29
  • Are you defined a MapView in the same Activity? What do you use for the ImageView? Maybe, it might be better another solution for feature you want. – Shoya Tsukada Sep 15 '11 at 09:23
0

Call invalidate in ondraw method.

Nikhil Lamba
  • 593
  • 1
  • 6
  • 17
0

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...

bhumika rijiya
  • 440
  • 1
  • 5
  • 42
  • Code appears to have come from [this question](http://stackoverflow.com/q/30408606/1677912). You should provide attribution when copying parts of answers. – Mogsdad Apr 19 '16 at 04:35