Posts

Showing posts from 2013

How to implement pinch and pan zoom on surface view ?

I spent lots of time to find the way, how to  implement zoom functionality on surface view, because in case of  image view you can implement it very easily by using matrix, but its implementation on surface view was not easy. I am going to share that particular code, may be it can helpful for anyone at anytime :). // AndroidSurfaceViewUI Activity  package com.example.zoom; import android.app.Activity; import android.os.Bundle; import android.view.ViewGroup; public class AndroidSurfaceViewUI extends Activity { ZoomView view; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); view = new ZoomView(this); view.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); setContentView(view); } } // Surface View package com.example.zoom; import android.content.Context; import android.graphics.Bitmap; imp