8

In my Xamarin forms application, there are multiple ListView controls inside a ScrollView. But in android the scrolling is not working for ListView. Is there any alternative solution?

1

5 Answers 5

9

You SHOULD NOT include ListViews into ScrollView as it system will confuse scrolling behavior of those two. You need to redesign your page with this in mind.

Example: 1) Use ListViews inside StackLayout 2) Use TableViews inside ScrollView

Sign up to request clarification or add additional context in comments.

1 Comment

ListView and TableView both have built-in scrolling. Wouldn't they both be equally susceptible to problems when nested inside a ScrollView?
8

You can simply do with set 'NestedScrollingEnabled' property true for native side. For xamarin forms you can create a custom renderer and set 'NestedScrollingEnabled' property true

    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.ListView> e)
    {
        base.OnElementChanged(e);

        if (e.NewElement != null)
        {
            var listView = this.Control as Android.Widget.ListView;
            listView.NestedScrollingEnabled = true;               
        }            
    }

Comments

3

ListView implements its own scrolling that might conflict with the ScrollView.

If you need to be able to scroll both lists in the same ScrollView you could for example create custom views (instead of using cells), placing them in a StackLayout inside a ScrollView

More about ListView performance, they even explain why you shouldn't place a ListView inside a ScrollView

Comments

0

Have you looked into using one listview with groups instead of multiple listviews?

Comments

0

I use any row of grid it will fix to that height & listview will not scroll

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.