Search code examples
androidimageviewzoominggestures

How to zoom two imageView with One Gesture?


I would like to pass a zoom gesture to another imageView or zoom both imageView using a pinch zoom....

I'm using this library https://github.com/jasonpolites/gesture-imageview

which has zooming, panning, double tap listener already....

now my target is when i pinch/zoom the topmost layer both images will be zoomed including the image behind it....

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background" >

<com.polites.android.GestureImageView
    android:id="@+id/image_areas"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scaleType="fitCenter"
    android:src="@drawable/p2_ship_mask"
    android:visibility="invisible" />

<com.polites.android.GestureImageView
    android:id="@+id/image"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scaleType="fitCenter"
    android:src="@drawable/p2_ship_default" />

</FrameLayout>

Solution

  • Got it... i created methods for setting the scale and position of my second imageview and redraw it...

    here's my code....

                    imageAreas.setScale(iv.getScale());
                    imageAreas.setPosition(iv.getImageX(), iv.getImageY());
                    imageAreas.redraw();