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?
Related
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.
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?
How is the best way to make three vertical screens with sliding between them, like ViewPager.
I want to show user middle screen with ViewPager for horizontal pictures sliding, and two screens for settings (top and bottom).
I tried to use ViewPager in ViewPager, but it's a bad solution for me.
Then ViewFlipper but could not make sliding between screens like ViewPager.
My last chance now is ViewDragHelper but I'm not sure.
Maybe somebody knows real example?
I intend achieving a layout similar to what is shown.
I have tried achieving similar behavior with Bottom sheet, percentFrameLayout, ScrollView and Coordinated layout on different occasions, but I've not being able to achieve something similar to the view that (possibly a fragment) that is scroll from the bottom of the screen and interact with other child views on the screen like the tab and the refresh button.
Any guideline and directions on how i can do this ?
You can use a RecyclerView for the cards and leave your toolbar and main content on a FrameLayout at the same level as the map. And of course a coordinator layout and proper behaviors on each element.
By doing this your recycler view will be able to interact with the toolbar and still be independent from the map.
In other words, you can reduce your problem to a single recyclerview scroll with a toolbar by making a space on the beginning of the vertical recyclerView.
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.:)