ViewPager do not behave elastically or get stuck in Views

耗尽温柔 提交于 2020-01-15 15:40:17

问题


I am working on ViewPager but a surprising problem comes up.

The ViewPager when scrolled to get next page, it got stuck if I take my finger off from screen, but normally the view should bounce back or next view should come up which it does not. Instead, ViewPager keep stuck in middle of both. I am loading bitmaps via AsyncTask and if I scroll fast there is no problem in loading bitmaps.

Here is preview of what I am trying to say -

(different color boxes are different screenshot combined in one image)

So if I leave picture while changing view, it just get stuck there, no bounce back or next view untill i manually scroll it. Here is ViewPager XML

<android.support.v4.view.ViewPager
    android:id="@+id/albumArt"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:adjustViewBounds="true"
    android:maxHeight="220dp"
    android:scaleType="fitXY"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true" />

And here is the code I am using: http://developer.android.com/training/displaying-bitmaps/display-bitmap.html

Thanks for giving your time and ask me if any further code required.

Cheers

来源:https://stackoverflow.com/questions/31537039/viewpager-do-not-behave-elastically-or-get-stuck-in-views

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!