I'm trying to implement a feature using motion layout. In that I have created a motion scene which scrolls from bottom to top and vice versa. After the view goes to the top a recyclerview will be show below to the motion layout.
Issue: While scrolling the recyclerview from top to bottom it's automatically drags the motion scene as well with the velocity applied in the recyclerview. But my objective is to not drag the motion layout as shown in the attachment.
Expected behaviour: After the recyclerview's scroll velocity reaches the top. The velocity has to be cancelled. Again, If the recyclerview is scrolled from top to bottom the motion layout should drag to the bottom based on the user's velocity.
source code
Related
Is there any way to change the scrolling angle of the ScrollView or RecyclerView in android?
I know, by default some Android views will have horizontal and Vertical scrollings, but I want to know if it is possible to change the scroll in a particular angle or else diagonally?
How to create such custom components?
Here is an example with screenshots, I wonder how Microsoft Excel Android App achieved this.
Place your finger on the cell D10 and drag the sheet towards the cell A1
Here is the result, the sheet scrolled diagonally, i.e., scrolled vertically and horizontally simultaneously
I have a scrollview and its vertical scrollbar. If I touch anything within the scrollview and drag, it will scroll the view the opposite direction I dragged. This is the behaviour I need.
If I on the other hand grab the scrollbar and drag it, it will not be in the opposite direction, but in the same direction as I dragged. I could simply hide the scrollbar, but it gives the user a sense of how much content the scrollview contains.
TL;DR
How do I disable touch events on scrollview's scrollbar?
I need a solution for the following problem :
i have a screen with vertical half portion having Linear Layout with content and lower half portion is having Grid View of Images(Tiled Area).
When finger makes contact with the tiled area and starts swiping upward, the tiled area moves upward at the same pace as the finger is moving - showing more picture below, while slowly covering white section above. After it cover the whole screen, the user can go scroll up and down swipes.
the opposite also applies: if the entire screen is covered with the tiles, and the top of the tile is already at the top of the screen, then further downward swipes will result in the opposite effect, ultimately shrinking(at the same pace as the finger is moving) the tiled area to its original size.
NOTE : view will move at the same pace as the finger moves. i think it will be done by gesture detector
What I'm trying to do is make a horizontal scroll view go circular.
Specifically, when the scrolling hits an edge the child view at the opposite end is moved there. My problem is continuing the fling animation after that.
I'm trying to capture the fling velocity with a GestureDetector and then pass it over to a Scroller (I tried OverScroller as well). When the view moving happens I call "getCurrVelocity()" on the scroller and then pass it to "fling()" on the scroll view.
Problem: The result is not continuous. The "restored" fling is faster than it should.
Note: One thing that looks wrong is fling() on the scroll view takes an int while the velocities you get from the GestureDetector and the Scrollers are float.
Problem statement: I would like the canvas to have the same size in both horizontal and vertical orientation. The size should be fixed and based on the vertical orientation (an A4-like canvas). Hence, I need the ability to scroll over the canvas in the horizontal orientation. But there is a conflict between the touch event used for scrolling in a ScrollView and the one used for drawing in the canvas.
What I need: I guess most could settle with this solution: fingerpaint within a horizontalscrollview and simply adding a button for allowing the user to scroll. For me this is a little counter-intuitive. What I would like is to have a thick scrollbar constantly visible on the side of the canvas, like in this app:
Following, this should also be the only way that the user can scroll.
What I have tried: Since the scrollview consumes all the touch events, I have tried overriding the scrollview's onTouch method. But this leads to the whole scrollview being unable to be touched - that includes the scrollbar.
Questions: Is it not possible to implement this with a ScrollView? Do I have to create my own scrollbar widget and align it horizontally (LinearLayout) with the view that contains the canvas? Or is there some way to have the ScrollView only consume touches on the background?
In onTouch override, you can check the coordinates and decide whether the touch was on the scroll thumb or on rest of the view.