ScrollView in PanResponder component - android

I am trying to create a card deck in the Bumble style (you have a card that you can swipe horizontally and can also scroll vertically to see more photos/info)
My problem is that whilst on iOS this works perfectly fine, in Android the ScrollView inside the PanResponder component seems to take priority on the gesture handling.
I have tried to dynamically change the scrollEnabled on the ScrollView as soon as a horizontal gesture appears, but this did not help.
Any chance you have any solutions?

Related

Ability to vertically scroll outer layout within a horizontal scrollbox

I'd like to be able to scroll through my main, outer layout vertically even if my thumb (touch) is within a horizontal scrollbox (which allows me only to scroll through its items horizontally). I've already tried replacing the horizontal scrollbox with a standard TScrollBox but without luck.
Examples of this can be found in applications such as Instagram (with their stories) and Facebook. A concept image is shown below from another question whose answer isn't applicable in Delphi.
Edit: there's a component in Android called 'Nested Recycler View' that does this exact thing I'm looking for. Is there anything similar for Delphi Firemonkey?
have you tried awsome controls from https://github.com/Zeus64/alcinoe
try to build single row of main layout with tabs and slide efect

Android animateLayoutChanges does not work properly for ScrollView with fillViewport true

I am trying to animate layout changes for a LinearLayout contained in a HorizontalScrollView with fillViewport=true. The idea is that I have a dynamic bar of buttons that should distribute to fill the available space, but if there are too many buttons you can start to scroll left/right to see them all.
This all works great, and using animateLayoutChanges=true on the LinearLayout works smoothly if the HorizontalScrollView has fillViewport=false, but as soon as it is set to true, jerky motions start to happen:
You will notice that the settings button jumps straight to its new position, while the right two buttons initially jump, but then animate a little to their final positions.
For me it seems relatively clear that the problem is that the extra x-offsets introduced by fillViewport=true are applied instantaneously, while the remaining shifting of the buttons is animated as normal.
Is there any way to get the animation to consider the effects of fillViewport=true as well?
Details only in case it matters: My HorizontalScrollView contains a LinearLayout that for each button contains a FrameLayout containing a Button (required in order not to stretch the button clickable area). I have tried applying animateLayoutChanges to the scroll view, to the frames, to the buttons, etc as well, but no combination seemed to make a difference.

Android: Vertical ScrollView inside a ViewPager -- unable to scroll

In my app, I have a ViewPager which contains 4 pages. The root element of two of those pages is a ScrollView. My problem is that I can perfectly scroll the ScrollView on my 4.2 Android Phone, but on my 2.3 Android Phone I can't.
So inside the ScrolView there are cliclable Views... I can click on them, but if I move my finger on it up and down the ScrollView doesn't gets scrolled. If I move my finger on the screen where there is only the ScrollView, it scrolls. Why is this? If I simply use the ScrollView layout without the ViewPager around it, the scrolling works perfectly on a 2.x and also on a 4.x Android Phone.
Actually it was my fault. The simple ScrollView works perfectly inside a ViewPager.
I have a ListView inside another ViewPager and there I had to make some tricks to make the ListView works, and from this I thought that I have to make the same tricks with the ScrollView too. But I didn't, and that was the problem.

How to hook into Android ScrollView when it starts/ends scrolling?

How do I programmatically hook into an Android ScrollView when it starts/ends scrolling? I have a custom View which is placed inside a ScrollView. I want my custom View to be informed right before the scrolling begins and just after the scrolling ends to execute some arbitrary code.
Note: I'm coming from iOS development and basically I'm looking for the Android equivalent of UIScrollViewDelegate.
For achieveing this, you need to create a Custom scrollview by inheriting from scrollview.
Check below link. It will help you :
Synchronise ScrollView scroll positions - android
Android: Detect when ScrollView stops scrolling

How to apply gesture inside scrollview in Android

I am developing Android application which contains the reading of epub books. In that I need to place two pages in book view. If those pages exceed the screen size user have to scroll and view the books and have to pinch zoom the book and user can pan the book for reading.
At first I tried to place two webview inside the Relativelayout. I can achieve this by placing relativelayout inside the scrollview and horizontal scrollview to scroll in both horizontal and vertical.
But problem occur in the swipping of pages and pinchzoom is not working inside the scrollview; it remains in the first page itself. I don't know where I am going wrong.
Are you putting WebView inside ScrollView? It functions funny that way. You'll have to disable the outside ScrollView if you're doing so.
You can modify ScrollView to be lockable, as in here.

Categories

Resources