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?
7
votes
5 Answers
9
votes
8
votes
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;
}
}
3
votes
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