kmshack / Android-ParallaxHeaderViewPager

DEPRECATED
Apache License 2.0
1.39k stars 336 forks source link

How to use with RecycleView or with ScrollView? #12

Open FedericoOldrini opened 9 years ago

FedericoOldrini commented 9 years ago

Can you post an example with ScrollView or with the new RecycleView class? Thanks

xifan-xf commented 9 years ago

just change this method: @Override public void adjustScroll(int scrollHeight) { if (scrollHeight == 0&& scrollView.getScrollY() > Constants.headerHeight) { return; } scrollView.scrollTo(scrollView.getScrollX(),Constants.headerHeight- scrollHeight); }

nschwermann commented 9 years ago

That only half way works, if the content of the scrollview isn't greater than the size of the window then the scrollview won't scroll when calling scrollTo

FedericoOldrini commented 9 years ago

I have also added a "footer" to the content whose height was dinamically calculated so every page can scroll at minimum the full height of the header. But is not a really clean solution

nschwermann commented 9 years ago

Yeah I was thinking of that, I ended up animating the header back to the original position if canScrollVertically returns false when switching the view page. Also not really the perfect solution but functional.