Zoom ImageView in android like Instagram

青春壹個敷衍的年華 提交于 2019-12-21 02:43:07

问题


How can I zoom ImageView like Instagram. I mean changing the size of imageview, not zooming the image inside the Imageview.

For zooming the image inside the Imageview, there are a lot of samples but I want something like Instagram image zooming

Any code or hint? Thanks.


回答1:


I would recommend these two libraries:

  1. PhotoView

  2. ImageViewZoom

For PhotoView, you just have to create an attacher and "attach" it to your ImageView.

Some code

// After getting your imageImage view, attach it like the following
PhotoViewAttacher yourAttacher = new PhotoViewAttacher(yourImageView);

With just this code, you'll be able to zoom in/out/whatever on yourImageView. Check the links above for more details.




回答2:


I recomended Zoomy is very simple and functional.




回答3:


thanks

I have added this to my gradle.build

 compile 'it.sephiroth.android.library.imagezoom:imagezoom:2.2.5'

and then using this view

  <it.sephiroth.android.library.imagezoom.ImageViewTouch
    android:id="@+id/mp3Image"
    android:adjustViewBounds="true"
    android:layout_width="346dp"
    android:layout_height="356dp"
    android:scaleType="fitCenter" />

and the below code, the zoom came to my app

   myImage = (ImageViewTouch) findViewById(R.id.mp3Image);
    myImage.setDisplayType(ImageViewTouchBase.DisplayType.FIT_IF_BIGGER);


来源:https://stackoverflow.com/questions/41795962/zoom-imageview-in-android-like-instagram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!