First you implement the Gallery View from the below code as:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:id="@+id/frameLayout2"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#ffffff">
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" android:layout_marginBottom="60dip">
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/examplegallery" android:layout_height="wrap_content" android:layout_width="fill_parent"/>
<FrameLayout android:id="@+id/fr" android:layout_width="fill_parent"
android:layout_height="150dip">
<ImageView android:id="@+id/ImageView01"
android:layout_gravity="center_horizontal"
android:layout_width="200dip" android:layout_height="200dip"/></FrameLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_greetings);
imgView = (ImageView)findViewById(R.id.ImageView01);
btn_capture = (Button)findViewById(R.id.btn_Grid_Capture);
btn_preview = (Button)findViewById(R.id.btn_Grid_PreviewGreeting);
imgView.setImageResource(Imgid[0]);
bundle = getIntent().getExtras();
gallery = (Gallery) findViewById(R.id.examplegallery);
gallery.setAdapter(new AddImgAdp(this));
gallery.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
imgView.setImageResource(Imgid[position]);
img_position = position;
}
});
}
Then Go through this link Pinching and Zooming:
android pinch zoom