像Instagram一样在Android中放大ImageView [英] Zoom ImageView in android like Instagram
问题描述
如何像Instagram一样缩放ImageView。我的意思是改变imageview的大小,而不是缩放Imageview中的图像。
How can I zoom ImageView like Instagram. I mean changing the size of imageview, not zooming the image inside the Imageview.
为了缩放Imageview中的图像,有很多样本但是我想要像Instagram图像缩放
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.
推荐答案
我推荐这两个库:
< a href =https://github.com/chrisbanes/PhotoView\"rel =noreferrer> PhotoView
对于PhotoView,您只需要创建一个 attacher
并将其附加到您的 ImageView
。
For PhotoView, you just have to create an attacher
and "attach" it to your ImageView
.
一些代码
// After getting your imageImage view, attach it like the following
PhotoViewAttacher yourAttacher = new PhotoViewAttacher(yourImageView);
只需使用此代码,您就可以放大/缩小/ yourImageView
。查看上面的链接了解更多详情。
With just this code, you'll be able to zoom in/out/whatever on yourImageView
. Check the links above for more details.
这篇关于像Instagram一样在Android中放大ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!