I have read on the github page for Android-ParallaxViewPager about implementing it using ScrollView but I didn't understand what it actually meant! :(
This is what given on the github page -
How to implement? see below.
1. Change ListView in NotBoringActionBar to ViewPager.
2. Make ListView or ScrollView of Fragment in ViewPager.
3. Make Interface that Activity can get a Listener when you use OnScroll() in ListView or ScrollView.
4. Make Interface which is available to scroll when some events is happened in ListView or ScrollView.
From now on, you can fix scrollY value in ListView wherever the pages are swiped through the interface you've just made.
Can anyone help me with this? I'm sure I'm not the only trying to get this working with ScrollView.
In its code kmshack has used an interface with onScroll() method accepting AbsListView view as a parameter.(for handling the scroll events inside ListView)
Does this mean that for ScrollView the onScroll() method should accept the ScrollView for handling the scroll events inside ScrollView?
Or a method has to be defined for handling the scroll events?
I'm confused! Please help me.
Related
I have a ViewPager2 of vertical orientation with each item consisting of Recyclerview. Sometime on fast scrolling, the content of the recylcerview is not scrolled rather page change is triggered on ViewPager2.
When this issue occurs, I am using NestedScrollableHost provided by Android Developer site doesn't get a callback inside onInterceptTouchEvent method.
Please suggest.
I am developing and application that will have to implement the swipe-to-refresh pattern described here. Looking at the android docs here, it is stated that:
You enable this behavior by adding the widget to your layout file as the parent of a ListView or GridView, and implementing the refresh behavior that gets invoked when the user swipes.
Well the issue is that I do not plan on having a ListView or GridView to layout my data, I am using cards (android.support.design.CardView) and I am planning on having a scrolling list of cards that the end user can swipe to refresh.
Can I still use the SwipeToRefreshLayout as described in the tutorial with my cards, or does it force me to use ListViews or GridViews to display my data?
Well as the documentation says that
The SwipeRefreshLayout should be used whenever the user can refresh
the contents of a view via a vertical swipe gesture.
This layout should be made the parent of the view that will be
refreshed as a result of the gesture and can only support one direct
child.
It does not mention that the view must be a ListView or a RecyclerView.
Also as seen in those questions:
SwiperefreshLayout in Android
Android SwipeRefreshLayout how to implement canChildScrollUp if child is not a ListView or ScrollView
Both of them have implemented a SwipeRefreshLayout with LinearLayout as the child View. So yes it will work with the view either being a CardView or a ScrollView.
Hope it helps!!!
Simple question - how to disable recyclerview scrolling while swiping its item? I created OnTouchListener inside recyclerView item view holder, but it catches swipe events only if user makes straight horizontal line. Otherwise recycler list is scrolling. Any ideas?
I am not using ItemTouchHelper because it doesnt quite do what I want. I solved this by checking the source to it and finding the call to:
getParent().requestDisallowInterceptTouchEvent(true)
Call that when you determine the user has started swiping (i.e., moved more than a few pixels). Then don't forget it to call it again with false when the swipe is done.
I'm facing the opposite problem. If you are using the ItemTouchHelper, do this
mItemTouchHelper.startSwipe(myViewHolder);
This would force the swipe instead of the scroll.
I need to implement a UI like this:
In the above screen row needs to be scrolled horizontally and columns need to be scrolled vertically.
I have not used Gallery as It is being deprecated. Here are some scenarios which I have tried:
1. Combination of GridView and ListView.
2. Combination of ListView and Horizontal ListView(Custom Component).
Option 1 did not work for me but I could make it with option 2.
With option 2 perfomance is not good.
Solution: I am thinking of implementing 4-5 horizontal listviews inside scrollview with Gestures so that I can handle the vertical swipe thru code or by subclassing the ScrollView and overriding the onScrollChanged method.
But I am looking for some more optimized solution.
Any help is appreciated.
Thanks
Use webview and push the content into it through JS hooks.
I have gone with my solution if anyone can suggest a better solution then obviously I will go with it:
Solution:
Implemented 4-5 horizontal listviews inside scrollview with Gestures
and handled the vertical swipe thru code or by subclassing the
ScrollView and overriding the onScrollChanged method.
I have a ScrollView and views inside it.
I want to have special behaviour on one of the child views in the ScrollView. My question is, does the view itself know when it is scrolled? Is there a callback, like onScrollChanged or something that can notify my view that the scroll in the scrollView is changed?
The views should not know about the parent scrollview.
I tried using ViewTreeObsever, and registering a onScrollChangeListener callback, but for some reason I get no callback whatsoever when I scroll things.
There is the OnScrollListener which handles scroll events.