This is a prototype of the design : https://i.sstatic.net/JMDRA.png Im not able to have the listView scroll if it's inside the scrollview.Is there anyway i can go about while having the scroll view for the Mainlayout enabled as well as the scroll for the listView which is inside another layout.
3 Answers
Application developers should not nest one ScrollView within another. Additionally, they should refrain from nesting them other elements that can scroll, such as WebView.
Source: official doc.
Nested ScrollViews are disaster just don't do that. Which control will get scrolled on a user interaction? It will totally ruin the UX, performance and etc. You have to rethink your UI.
Comments
Like @EvZ suggests you shouldn't have a Listview which already has a Scrollview inside a Scrollview but unfortunately we might end up in this situations.
You can use this custom renderer for Android to make all your listview work inside scrollviews.
[assembly: ExportRenderer(typeof(Xamarin.Forms.ListView), typeof(ListViewScrollRenderer))]
namespace Glu.Droid.Renderers
{
public class ListViewScrollRenderer : ListViewRenderer
{
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;
}
}
}
}