0

I am developing an android app and I have set images on relative layout. Now I want to zoom the images through gestures (pan zoom) and the relative layout doesn't contain any imageview. The images are directly set on the relative layout.

Alex Cohen
  • 5,596
  • 16
  • 54
  • 104
NS.
  • 98
  • 1
  • 13

1 Answers1

0

Well in my openion its not a good practice to zoom the parent layout as it might create complications but you can find the possible solutions zoom in/out RelativeLayout and this Github Gist might help you in this regard.

Othere better solution to your problem can be you can create an ImageView with match_parent attributes and use PhotoView to zoom the images, its amazing library for zooming the images, I am personally using it in my multiple projects.

This is the ImageView with match_parent attributes using PhotoView.

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <uk.co.senab.photoview.PhotoView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scaleType="fitXY"
        android:adjustViewBounds="true"/>

</RelativeLayout>

You can find all the information about implementing the library here.

Hope it helps

Community
  • 1
  • 1
Atiq
  • 14,435
  • 6
  • 54
  • 69