Sample code for smooth scrolling of complex images in Android
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


view_cache_demo is a sample Android application demonstrating how to do
smooth scrolling of a complex image view by caching a bitmap rendering
of the image. Without this, scrolling would be jerky because of the
time taken to redraw the view each time.

All this custom handling is implemented in the DrawView class. This
caches only a limited area beyond the immediately-visible portion of
the view, to try to reduce memory usage. The cache is automatically
regenerated as the user scrolls the image. This class also demonstrates
custom handling of single-tap, long-tap and double-tap events, with
automatic conversion of tapped position to original image coordinates.

Drawer is an interface to be implemented by the class that defines the
actual image to be drawn in the view.

BundledSavedState is a generic class for easier implementation of
save/restore instance state in a custom View.

    src/ -- Java sources for the Android app
    res/ -- resources for the Android app
    AndroidManifest.xml, build.xml, *.properties -- for driving
        Google's Android build tools (note that you will have to
        provide a couple more of these--see INSTALL for details)
    README -- this file
    INSTALL -- build/installation instructions
    LICENSE -- licence (Apache 2.0, same as Google's sample code)

Like the icon? It's by Tehkseven--more here

Lawrence D'Oliveiro <>