ImageViewZoom icon indicating copy to clipboard operation
ImageViewZoom copied to clipboard

Problem with activity transitions & ViewPager

Open MikolajLen opened this issue 10 years ago • 11 comments

Hi, I am using ImageViewTouch inside ViewPager (as full screen gallery). When I start my acitivity with transition, ViewPager displays correctly only first page - on every different i do not see image. In earlier version of Your library ViewPager was initializing correctly, but there was problem with transition.

MikolajLen avatar Jun 19 '15 09:06 MikolajLen

yes, I've noticed that either. I'll try to see what's happening during a transition

sephiroth74 avatar Jun 19 '15 15:06 sephiroth74

I got the solution from here: http://stackoverflow.com/questions/13860832/viewpager-imageview-zooming-issue

tuanchauict avatar Aug 17 '15 13:08 tuanchauict

@sephiroth74 I have this problem too. Any idea how we can fix it?

mecid avatar Sep 15 '15 14:09 mecid

@mecid take a look at this http://stackoverflow.com/questions/13860832/viewpager-imageview-zooming-issue

tuanchauict avatar Sep 16 '15 07:09 tuanchauict

@tuanchauict not working for me.

mecid avatar Sep 17 '15 10:09 mecid

Any news on this?

shmoula avatar Oct 08 '15 15:10 shmoula

@sephiroth74 I have this problem too.

Seems the problem is brought by ViewPager. More exactly, the problem is occurred when image is set while the fragment isn't visible.

xingrz avatar Oct 10 '15 16:10 xingrz

@sephiroth74 I'm investigating this issue. What I found is:

  • The left of the first image matrix in the first page is 0
  • Then that one in the second page is 1080, which is my screen's width
  • The third is 2160, and so on...

Than I extends the ImageViewTouch class and override this method:

@Override
protected void onViewPortChanged(float left, float top, float right, float bottom) {
    super.onViewPortChanged(0, top, right - left, bottom);
}

the problem is fixed.

So the code above is a workaround.

The problem may be the incorrect base matrix.

xingrz avatar Oct 10 '15 16:10 xingrz

@xingrz works for me, thank you!

shmoula avatar Nov 05 '15 17:11 shmoula

No need to override ImageViewTouch.

Wrapping the view into a FrameLayout does the trick for me:

FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

<com.testproject.base.view.ImageViewTouch
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="fitCenter"/>

/FrameLayout>

DiegoCast avatar Jun 06 '17 16:06 DiegoCast

@xingrz works for me too! thank u very much!

wynhe avatar Jul 21 '17 18:07 wynhe