question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improvement on Nesting CardView in ScrollView

See original GitHub issue

Improvement on nesting CardView in ScrollView. Your workaround is completely functional, save the fact that it doesn’t enable high velocity scrolls (when a user scrolls fast and lifts it only scrolls a little bit). I have a suggestion to avoid the interface and possibly fix the scrolls not feeling smooth with the current workaround.

Put a boolean bindable prop in the card control named something like AutoFindAndScrollParentScroll. What could be better about finding the parent is that you could add a custom Effect to whatever ScrollView is the parent and it could properly pass the pan effect to the ScrollView using the native Effect.

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/effects/introduction

then if its true do something like this on vertical panning:

                        ScrollView scrollView = null;
                        var parent = this.Parent;
                        while (parent != null)
                        {
                            if (parent.GetType() == typeof(ScrollView) || parent.GetType().IsSubclassOf(typeof(ScrollView)))
                            {
                                scrollView = parent as ScrollView;
                                break;
                            }
                            parent = parent.Parent;
                        }
                        scrollView.ScrollToAsync(0, yValue);
                        // OR even better add the effect to the scrollview to pass pan args natively

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kcrandallcommented, Nov 5, 2019

Oh damn sorry didn’t see that lol. It works now thanks!

1reaction
kcrandallcommented, Oct 20, 2019

I tried it and it works the same way as adding the interface. It’s just all done inside the CardView. I made a PR. More work is needed to make the scrolling more fluid. This has to be done natively. If I have time ill look into it and adding an effect to the ParentScrollView I added in the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CardView in NestedScrollView increases elevation ...
I'm adding cards in a nested scrollview. The card elevation automatically increases for the cards that are lower down the order in the ......
Read more >
NestedScrollView in Android with Example
NestedScrollView is used when there is a need for a scrolling view inside another scrolling view. You have seen this in many apps...
Read more >
Cardview horizontal scroll android. To scroll in Vertical ... - OSFL
Nested Scroll view hold only one direct view as child if you wants to add more then you have to ... 0'. android-cardview;...
Read more >
Expandable cardview in recyclerview android. But you can ...
The following is an example for creating nested RecyclerViews in Android. ... expandablerecyclerview; Share. mp4 A scroll view contains a single direct ...
Read more >
Recyclerview not scrolling smoothly android. Recyclerview not ...
The scrolling is not smooth and is quite irritating can something be done to improve this? Nested scroll View not scrolling smoothly with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found