Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to force fill image to view #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

option to force fill image to view #12

wants to merge 1 commit into from

Conversation

jeancaffou
Copy link

fill image in view instead of fit to view and image can not be smaller than the view in any dimension

example:

img = (ImageViewTouch) findViewById(R.id.image);
img.FORCE_FILL = true;

I'm sorry for the large diff, as I used a code formatter, the actual difference is:

public boolean                  FORCE_FILL          = false;

in ImageViewTouchBase class

and

float scale = FORCE_FILL ? Math.max(widthScale, heightScale) : Math.min(widthScale, heightScale);

in getProperBaseMatrix method in ImageViewTouchBase class

fill image instead of fit to view and image can not be smaller than the view in any dimension
@SalmanTKhan
Copy link

jean for some reason this slows down my scrolling horizontally on the image to a point of being a bit unresponsive.

@saurabhkpatel
Copy link

Using above code i can fill image in fit to Screen , right now its not happening. why?

@Malachiasz
Copy link

"Using above code i can fill image in fit to Screen , right now its not happening. why?" because fill modifier is not supported

@sephiroth74
Copy link
Owner

why dont use the setDisplayType( DisplayType.FIT_TO_SCREEN ) ?

@saurabhkpatel
Copy link

@Malachiasz Which Fill modifier is not supported? So what is the use of above mentioned code?

@jeancaffou
Copy link
Author

Well, the above code works for me.

@saurabhkpatel
Copy link

hi @jeancaffou thanks for your reply... I used above code. which you mentioned in first post on this thread.

but its really didnt work for me. Please can u please explain me more about this.?

public boolean FORCE_FILL = false;

Thanks.

@saurabhkpatel
Copy link

@sephiroth74 Thanks for your reply. I used this line setDisplayType( DisplayType.FIT_TO_SCREEN ).

I am able to make fit image on screen but when i double tap the image and than scroll the image Images is cutting and i cant able to see remaning part. only able to see fir to screen part.

Please can u help me to sort out this issue.

Thanks

@jeancaffou
Copy link
Author

@saurabhkpatel
Copy link

Thanks for your fast response. @jeancaffou .

I used some extra things also because i want to integrate this ImageViewTouch with Universal Image Loader also.

I used below xml file content for ImageViewTouch. I used correct scaleType?

<it.sephiroth.android.library.imagezoom.ImageViewTouch
    android:id="@+id/iv_pager_image"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:adjustViewBounds="true"
    android:contentDescription="@string/descr_image"
    android:scaleType="matrix" />

And i Changed in ImageViewTouch file as i had some issues with view pager scaling.

http://stackoverflow.com/questions/13359205/image-isnt-displayed-in-imageviewzoom

http://stackoverflow.com/questions/13398288/image-zoom-issue-with-universal-image-loader-and-view-pager

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants