简体   繁体   English

从图库或相机设置图像以适合Imageview android

[英]set image from Gallery or Camera to fit to Imageview android

I set image From Gallery and Camera to Imageview.I used Touchimageview for pinch Zoom Functionality for imageview. 我将图像从图库和相机设置为Imageview,并使用Touchimageview进行捏合缩放功能以实现imageview。

Here is Link For this Touchimageview : https://github.com/MikeOrtiz/TouchImageView/blob/master/src/com/ortiz/touch/TouchImageView.java 这是此Touchimageview的链接: https : //github.com/MikeOrtiz/TouchImageView/blob/master/src/com/ortiz/touch/TouchImageView.java

But image is not set ProPerly in Imageview. 但是没有在Imageview中设置图像ProProly。

在此处输入图片说明

In the Picture, 在图片里,

The left side is What Actually happen with me. 左侧是我实际发生的情况。

The Right side which i wanted Fit to imgeview same as Imageview height. 我想适合imgeview与Imageview高度相同的右侧。

I Used ScaleType = "CenterCrop" But After That i Cant able to Zoom in Out in Imageview. 我使用ScaleType =“ CenterCrop”,但是之后我无法在Imageview中放大。

1).How to Crop Bitmap Like Fit to imageview with keep aspect resio? 1)。如何在保持纵横比的情况下裁剪适合于imageview的位图?

2).or How to set Image From gallery or camera to Fit To imageview And Add Zoom in out Functionality? 2).or如何将图库或相机中的图像设置为适合图像视图并添加放大功能?

Help me to Solve This issue 帮我解决这个问题

Thanks You in Advance 提前谢谢你

For zoom-able ImageView user Gesture ImageView Library 适用于可缩放的ImageView用户Gesture ImageView库

You can download library from here, it's easy to use. 您可以从此处下载库,它易于使用。 this library provides you zoomable ImageView so use Gesture ImageView instead of Simple ImageView 该库为您提供了可缩放的ImageView,因此请使用Gesture ImageView而不是Simple ImageView

https://github.com/jasonpolites/gesture-imageview https://github.com/jasonpolites/gesture-imageview

use android:scaleType="fitxy" . 使用android:scaleType="fitxy" Make sure your image is of higher resolution, otherwise the image will lose its quality. 确保图像具有更高的分辨率,否则图像将失去质量。 It may also look stretched if it the image doesn't maintain aspect ratio 如果图像不保持宽高比,也可能看起来很拉伸

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM