Zooming image in android
<p>I want to add an image in my application which is like a road map image.
I want to add zooming features to this image as well as horizontal scrolling when the image is zoomed.</p>

<p>I have written some code but it allows only zooming and not scrolling.</p>

<p>Code:</p>

<pre><code>public class Zoom extends View {
    private Drawable image;
    private int zoomControler=20;
    public Zoom(Context context)
    {
            super(context);
            image=context.getResources().getDrawable(R.drawable.boothmap);
            setFocusable(true);

    }
    protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler);
            image.draw(canvas);
    }
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {

            if(keyCode==KeyEvent.KEYCODE_DPAD_UP)// zoom in
                    zoomControler+=10;
            if(keyCode==KeyEvent.KEYCODE_DPAD_DOWN) // zoom out
                    zoomControler-=10;
            if(zoomControler&lt;10)
                    zoomControler=10;

            invalidate();
            return true;
    }
}
</code></pre>

<p>Can you help me solving this problem. Is my code proper so far or do you have any better code?</p>
