How to create an infinite viewpager, but with only one view? For example, I want to scroll the view to the left, then update it and show the same view from the right. I need to see cool animation, with dragging view under the finger, not just to detect the gesture and slide out. I also need to understand in which direction the scroll happened.
Please help!
Related
I need to implement an animation in ViewPager2
where user can drag first or last item
beyound the bounds (for half of screen width),
and items will bounce back with animation automatically.
Please help me to understand, in which direction I should investigate
for implementing such an animation?
It's about GestureDetector, or MotionLayout, or anything else?
I am using a view pager in a recycler view cell, which is swiped to reveal a checkmark image. Outside of this, the recycler view is contained in a fragment which is located inside of another viewpager. What I want to accomplish is, after the cell's viewpager finishes, it begins to drag the view pager containing the fragment. I have been working on this for two days and have not reached any solution. It works fine if I lift my finger between swiping the view pager in the cell and then swiping the screen again to swipe the fragment's view pager. However, I want this swipe to be possible without having to lift a finger off the screen. A good model of this is snapchat's swipe to message views. Any help would seriously be appreciated. i do not know what to do. I can provide code, but it's fairly complicated and messy.
The images below are the current app I am trying to execute this behavior in. They are for testing purposes of course. Image 1) is before nothing is swiped. Image 2) is after the cell's view pager has been swiped, and Image 3) is after the fragment's view pager has been swiped. What I want is for there to be no need to touch the screen twice in between images two and three.
best solution is to find a view that does the swipe effect without a pager
cause this is a lot of nested views
I've used one before that has done the job
check this library I used it to implement a row with a swipe to show call button and was inside a tabbed activity didn't have any issues
https://github.com/daimajia/AndroidSwipeLayout
goodluck
I'm trying to do a recycler view animation on scroll, but im struggling to get it started.
Basically, the animation will happen on scroll and always on the first visible child (and only on this one). When the user scrolls the recycler view, second item should overlap the first, and the first will slowly fade out. reverse animation when sliding down.
In short, when the list scroll top for example, when the first item goes offscreen and want to change that behaviour. Instead of going offscreen, it slowly fades based on scroll dY and stay in the same position.
Any hints would be much appreciated.
I think this answer may can help you. I used code like this in my app and work smootly.
https://stackoverflow.com/a/29714138/2971619
Hope to be usefull for you too!
I have no idea how to implement a HorizontalScrollView that scrolls on swipes. And it should scroll to specific position. The positions are one the picture. The first one is how it appears from the beginning. Then when you swipe right, the scrll view slides to the beginning and number appears. Then when you swipe left you come back to the first position. And after swipe left from the first position, scroll view scrolls to the end and shows sharing options.
I think this should be implemented with ViewPager rather than Horizontal ScrollView.
Take a look to the official documentation
I just discovered Rando app for Android today and I totally felt for the simple UI. I particularly like this sticky red button on their ViewPager:
I know how to make a sticky view over a ViewPager, placing it outside of the ViewPager in the same ViewGroup. But here the red button is partially sticky. When you scroll left, it's scrolling. When you go right, it keeps its position.
Apart from going the ugly way (having two ViewPagers (?!)), I have no idea how they made that. Custom view pager? maybe! Any idea?
I guess one idea would be to detect the page scrolling using onPageScrolled method, detect if scrolling direction is left or right, then manually update the position of the red circle accordingly.
See also:
How to know viewpager is scroll left or right?