Good day. I have activity with viewpager 2 (horizontal direction) and fragment which used by this viewpager. This fragment contains collpasing toolbar and nested scroll view with scrolling content. When i triyng to scroll content of my fragment from bottom to top and when, i'am scrolling up, the finger moves a little to the side - the scrolling is interrupted and the horizontal scroll of the view pager is triggered. How i can disable horizontal-scroll of the view pager while i'am scrolling vertical nested scroll view?
Related
I am attempting to use a ViewPager2 with fragments, and I would like to be able to swipe both vertically and horizontally. I have tried implementing a GestureListener for detecting swiping, both on the ViewPager2 and on the fragments within, but neither are picking up the events. Is there some way to either detect swipes within a viewpager2, or have the orientation be both vertical and horizontal?
I've a BottomSheetDialogFragment inside a RecyclerView, when is clicked a button BottomSheet is showing. BottomSheetDialog expanding when scrolling down and collapsing when scroll finished on top normally.
But when I place the RecyclerView inside a fragment and lay the fragment to BottomSheetDialog; BottomSheet behaviours not working on the fragment, only works RecyclerView scrolling. On the other hand the behaviours work other places on BottomSheet. How to enable the behaviours as in the first?
You should check that your container layout has app:layout_behavior="#string/bottom_sheet_behavior"> and check that any listener/event you define extra, otherwise BottomSheetDialog normally behaive as you expect.
I have a layout with two fragments. Both fragments have a Recyclerview. I want, When I scroll any of a recyclerView Then another recyclerView also scrolled automatically. How can I do this?
If you don't see each fragment at the same time, you could get the position of the viewable RecyclerView when you change views, then set the other RecyclerView to the same position.
I would like to allow the ViewPager to swipe normally to the right/left as it is and detect Vertical Flings. I tried to assign a GestureDetector but the problem is that returning true from the method public boolean onDown(MotionEvent e) disables the normal horizontal swiping of the ViewPager. Any ideas how to allow both?
There are already some custom controls for this. Try looking into these threads of how to implement a Vertical ViewPager.
http://vision-apps.blogspot.ro/2013/05/4-directions-swipe-navigation.html
How to put Vertically swiped ViewPager in a Horizontally swiped ViewPager
https://stackoverflow.com/questions/14889530/vertical-viewpager-implementation
Hope this helps.:)
I have a 'page' that has a number of components on it, and who's content is longer than the height of the device. one of the component is view pager. Content of view pager is also very large. How can i combine vertical scroll view of parent layout and view pager layout.My laytout is as follows:
few components
view pager-(large content in another layout)
few more component
i want to combine scroll view of view pager and parent layout
It should just work. See here -> ViewPager inside a ScrollView does not scroll correclty
You structure should be like this:
ScrollView
-ViewPager
--ScrollView
Then just apply the suggestions made in the linked post above.
Also make sure the ViewPager has a fixed height! Otherwise the ScrollView inside the ViewPager won't work without writing a custom ScrollView or ViewPager.