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

On initial launch, doesn't transform #33

Open
cyrus88 opened this issue Mar 28, 2018 · 2 comments
Open

On initial launch, doesn't transform #33

cyrus88 opened this issue Mar 28, 2018 · 2 comments

Comments

@cyrus88
Copy link

cyrus88 commented Mar 28, 2018

On initial fragment launch which contains viewpager. It doesn't transform and after scroll, it works fine.

Here a code in onCreateView() fragment:
homeBinding =
DataBindingUtil.inflate(inflater, R.layout.fragment_home_layout, container, false);
view = homeBinding.getRoot();
mHomeAdapter = new HomePagePagerAdapter(projectList, getActivity(), mConfig);
ViewPager pager = homeBinding.pagerContainer.getViewPager();
pager.setAdapter(mHomeAdapter);
pager.setOffscreenPageLimit(3);
new CoverFlow.Builder()
.with(pager)
.scale(0.3f)
.pagerMargin(-100)
.spaceSize(0f)
.build();

@DrRey
Copy link

DrRey commented Apr 6, 2018

I solved a similar issue by implementing a small fake drag to the viewpager after it has been initialized:

        Handler().postDelayed({
            if (viewPager.beginFakeDrag()) {
                viewPager.fakeDragBy(1.0f)
                viewPager.endFakeDrag()
            }
        }, 10)

@androidovshchik
Copy link

androidovshchik commented Apr 17, 2019

@DrRey Instead of hadler it's mush eaiser to use post function

viewPager.post {
    if (viewPager.beginFakeDrag()) {
        viewPager.fakeDragBy(1.0f)
        viewPager.endFakeDrag()
    }
}

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

No branches or pull requests

3 participants