Rushang Prajapati
Rushang Prajapati

Reputation: 596

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.

Here is Link For this Touchimageview : https://github.com/MikeOrtiz/TouchImageView/blob/master/src/com/ortiz/touch/TouchImageView.java

But image is not set ProPerly in Imageview.

enter image description here

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.

I Used ScaleType = "CenterCrop" But After That i Cant able to Zoom in Out in Imageview.

1).How to Crop Bitmap Like Fit to imageview with keep aspect resio?

2).or How to set Image From gallery or camera to Fit To imageview And Add Zoom in out Functionality?

Help me to Solve This issue

Thanks You in Advance

Upvotes: 0

Views: 767

Answers (2)

Nitin Mesta
Nitin Mesta

Reputation: 1504

use 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

Upvotes: 0

Jenisha Makadiya
Jenisha Makadiya

Reputation: 832

For zoom-able ImageView user Gesture ImageView Library

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

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

Upvotes: 2

Related Questions