O'Reilly logo

Building Android UIs with Custom Views by Raimon Ràfols Montané

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Zooming and scrolling

Another interesting feature we can implement into our custom view is the ability to zoom and scroll. Like we did in our previous chapter, we'll use the ScaleDetector class from Android to detect the pinch gesture and update the zoom in our custom view.

Implementation will be quite different from the previous chapter. In this case, we'll do it in a simpler way. As we want to zoom everything, we'll just apply a canvas transformation instead of regenerating the scaled Path objects again, but first, let's implement the gesture detector and add the ability to scroll and animate properties.

We can almost copy the same methods we used in our previous custom EPG View for animating variable logic and checking if we still have ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required