Git Product home page Git Product logo

Comments (9)

taeyoung4808 avatar taeyoung4808 commented on June 23, 2024 6

same issue..

i use a trick this
pagerAdapter.notifyDataSetChanged(); viewPager.setAdapter(null); viewPager.setAdapter(pagerAdapter); viewPager.setCurrentItem(viewPosition);

i'm working

from android-coverflow.

djshanne avatar djshanne commented on June 23, 2024 2

Hello,I had the same issue, the solution:

private void saveItem() { pagerAdapter.addItem(new Item("ItemAdded")); cardPager.setOffscreenPageLimit(pagerAdapter.getCount()); // this is the important thing cardPager.setCurrentItem(pagerAdapter.getCount()); // this is cos the problem still there when we add an item, but if you select the item inserted then the pager will show the new item added correctly }

from android-coverflow.

StephenVinouze avatar StephenVinouze commented on June 23, 2024 1

Hi there!

Same issue here while removing item from my ViewPager (which calls notifyDataSetChanged()). I am currently using a library that wraps the ViewPager with additional features. When removing my item, the library takes care of updating the ViewPager content and scroll to next position. However both scale and margins are broken and only scrolling the content refreshes the pager correctly.

I tried to force an invalidate() that is done in the onPageScrolled() callback but with no success. I obviously tried the solution above but it is not always working. Plus this is not the wanted behavior as I definitely don't want to have my pager scrolling the last item.

Any idea how to simply achieve this force refresh to keep the CoverFlow correctly configured

from android-coverflow.

StephenVinouze avatar StephenVinouze commented on June 23, 2024

Actually combining both setOffscreenPageLimit() setCurrentItem() seems to do the trick for all items except the first and last item in the pager, especially if you only want to scroll forward (after add item to pager) or back (after remove item from pager). Seems erratic to me :)

from android-coverflow.

RomiValladares avatar RomiValladares commented on June 23, 2024

I've stumbled with this issue too. Simulating a MotionEvent was the only thing that worked, though it obviously looks bad, and is prone to looking worse across devices.

from android-coverflow.

maximPetlyuk avatar maximPetlyuk commented on June 23, 2024

Confirm bug. Angle issue.

from android-coverflow.

catroom avatar catroom commented on June 23, 2024

@djshanne After call notifyDataSetChanged(),my view has no cos。event if i setOffscreenPageLimit,can you sovle it??

from android-coverflow.

djshanne avatar djshanne commented on June 23, 2024

Can you tell me, what do you mean with has no cos ? Sorry I dont get it. @catroom

from android-coverflow.

krunal3kapadiya avatar krunal3kapadiya commented on June 23, 2024

I also have the same problem can anyone have a solution for it ?

from android-coverflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.