using animations inside a view object to pan / zoom around a large image
posted 5 years ago
Hello, I'm new to android development and have a question regarding animating an image within a custom view. I've created a custom view to display a bitmap image without any trouble. The image is over-sized and extends the frame of the screen, which is what I want. But now I want to be able to scroll to particular predetermined regions of the image based upon a gesture. I am able to get the functionality using a gesture listener with mView.scrollTo(x, y); or even mView.scrollBy(x,y) within the gesture handlers. However, the position movement is very dramatic, and I need to slow it down so that is smoothly scrolls to the regions. The effect is similar to Dr Suess eBooks available in the android market...here's a video demo that show the "panning" effect http://www.examiner.com/technology-in-national/dr-seuss-android-video -- I'm not really creating an ebook but the effect is the same, being able to swipe and have the screen move around to predetermined spots on the image detailing notes at each point. I do not want to scroll to follow finger gestures on the screen, i just want to be trigger the move to a new location via a swipe. I've been able to get this working by animating the view in an xml file, but that simply animates the entire view object and moves it around the screen. I want the same effect INSIDE the view object. Is there a way to slow down the scrollTo(x,y) function? or am I totally going in the wrong direction with how to do this?