MaterialViewPager
MaterialViewPager copied to clipboard
Can't scroll down if the first tab is not scrollable and the second is.
I know the title is confusing so I recorded this:

Initial tab "Rozmiar" is not scrollable as the content is really small. I switch to another "Galeria" and here I scroll down so the header is hidden. When I get back to "Rozmiar" I see header field but it's content is still somewhere over the screen :)
Im having a similar problem with expandings/collapsing lists making the material view pager unreachable. Can we get a method to expand the material view pager to a certain height?
Yea i have the same problem ..This is right now the main problem in my app :/ if there is a fix id love to know how to
Yes I know why, it's because the ScrollView or the Recyclerview on your second page (ROZAR) is to small to scroll... Can you try to add an empty view behind your cards, like 1000dp and tell me if the bug already happen please ? (it's a small fix, not a good solution)
2015-06-25 22:26 GMT+02:00 Niclas [email protected]:
Yea i have the same problem ..This is right now the main problem in my app :/ if there is a fix id love to know how to
— Reply to this email directly or view it on GitHub https://github.com/florent37/MaterialViewPager/issues/89#issuecomment-115387044 .
i found out something, its not the best fix .. but i guess it will do for now. In your fragment where you have your recyclerview:
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
mResetRecycler.smoothScrollToPosition(0); //I use this to get back to pos 0 if i have many cards
MaterialViewPagerHelper.getAnimator(getActivity()).onMaterialScrolled(null, 0); //jump back to 0 Yoffset
}
}
What this does is that it will tell your fragment that its right not being shown for the user. (This will not provide any animation it will just end up at the start position again.
I just this to register the RecyclerView in my onCreateView
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mResetRecycler, null);
but yea, its not the sexiest solution but it works, would be great if could create a
MaterialViewPagerHelper.getAnimator(getActivity()).onMaterialScrolled(null, 0).animate(true);
To animate the view back to its normal position or to what ever Yoffset the user chose
@florent37 yea i tried that, or i tried adding 3 more items to the adapter but with setVisa(INVISIBLE); on everything position > 0, but this gave me inviible scrollable items lol and yes while that added the scroll to the view, it didnt pop back as i wanted. So thats when i did found the solution above. This will every time you come to this fragment the adapter will take you to position 0, then set the view after scroll was done, with the onMaterialScrolled(). But now i only have 1 card, so no more weird invisible scrolling on items.
+1 for
MaterialViewPagerHelper.getAnimator(getActivity()).onMaterialScrolled(null, 0).animate(true);
Placing empty view in the small tab is not an option because it's an empty view and the user would have to scroll manually anyway ;)
yes, the
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
mResetRecycler.smoothScrollToPosition(0); //I use this to get back to pos 0 if i have many cards
MaterialViewPagerHelper.getAnimator(getActivity()).onMaterialScrolled(null, 0); //jump back to 0 Yoffset
}
}
seems correct, it force to scroll top
I have an idea, it could be directly implemented into MaterialViewPager, if the scroll content is too small, or can't scroll, when it becomes visible again, we scrool to top with this code. Do you agree ?
yea, that sounds good :)
Hope my small "fix" will help anyone with this problem until we have a official fix :)
When will 1.0.6 roll out?
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
mResetRecycler.smoothScrollToPosition(0); //I use this to get back to pos 0 if i have many cards
MaterialViewPagerHelper.getAnimator(getActivity()).onMaterialScrolled(null, 0); //jump back to 0 Yoffset
}
}
is a fragment method, I don't know how to implement it for the users
what would be the best solutions ?
Maybe, if the user swipes to to the next page (left or right swipe). And lets say that the user has scrolled up a bit on ythe current view so that toolbar and icon has been collapsed. When the user swipes, at the same x-velocity the toolbar expands again. So on swipe, you trigger the scroll and convert the x-velocity in the swipe to a y-velocity in the scroll of the recycler or listview?
The programmer can add this by calling in the xml
app:expande_on_swipe=true"
or by code
MaterialViewPagerHelper.smothScrollViewToOnSwipe(Recyclerview, ListView, y-offset)
I worked for you this morning guys :)
can you try with the 1.0.5.3
? (i'll send the 1.0.6 if this version is ok)
So how are we supposed to handle this in 1.0.5.3?
Btw I just noticed that when I scrolled up my list a bit, so the tabs got pushed up a bit I couldn't click on them anymore (swiping still works though)
Hey, what's the status on this?
Hi,
I'm also unclear on how to implement the improvement you made on this issue. Could you clarify this for us please?
Thank you
MaterialViewPagerHelper.getAnimator(getActivity()).onMaterialScrolled(null, 0);
does not seem to work as it is private.
So was this issue resolved? or is there a way to programmatically show the header?
Hello, I am trying to use : MaterialViewPagerHelper.getAnimator(getActivity()).onMaterialScrolled(null, 0); but is it private so it doesn't work ... Can you please help me?