Smooth scrolling in ScrollView with Horizontal SFListView

Hello,
I have a ScrollView which contains a horizontal SfListView (showing bunch of cards => Data Template is SfCardView) and IsScrollingEnabled="False". When starting the scrolling by touching an area inside the parent ScrollView (outside SfListView) and then leaving the touch (finger on screen, scroll and leave your finger), the scroll is smooth and dosen't end suddenly, and continues to scroll a little more depending on the scrolling speed you have applied on the screen when started scrolling.
When I start the scrolling from inside the SfListView, although I am able to scroll, but when I remove my finger from the screen the scrolling stops immediatly, and the effect that is happening by the ScrollView is not occuring which is annoying.

 Any workarounds?

Thanks a lot

11 Replies 1 reply marked as answer

SS SaiGanesh Sakthivel Syncfusion Team March 22, 2021 03:49 PM UTC

Hi Mohammed,

 
Thank you for contacting syncfusion support. 
 
#Regarding Smooth scrolling in ScrollView with Horizontal SFListView 
we regret to inform you that we could not replicate the reported scenario from our side. We have prepared the sample as per given information and we have tested the sample with AndroidX (Realme x2 pro) device. Please refer to the tested sample in the following link for your reference. 
 
 
Please check the sample and let us know if you still facing the same issue? If not, please modify the sample based on your scenario and revert us back with the following details, 
 
·       Share the syncfusion version used in the sample. 
·       Share the Xamarin version version used in the sample. 
·       Share the issue replicated platform. 
·       Share the issue replicate video. 
 
 
Regards, 
SaiGanesh Sakthivel 



KA Karro March 22, 2021 08:50 PM UTC

Hello SaiGanesh and thank you for the quick response,

I have checked your sample and it works as expected. After updating the nuget packages to match the same packages in my project, the problem occured in your sample too.

I have modified the sample and attached a screenshot video that illustrates the issue.

Technical Info:

Target framework for the shared project :

     .Net standard 2.1

Android target framework:

     10.0 (Q) I have tested on the visual studio android emulator with (Android: 10.0, API level: 29).

IDE:

     Microsoft Visual Studio Community 2019, Version 16.9.2

Installed nuget packages :

     Xamarin.Forms v5.0.0.2012, Xamarin.Essentials v1.6.1, Syncfusion.Xamarin.Cards v18.4.0.48, Syncfusion.Xamarin.SfListViewv18.4.0.48


Attachment: ListViewXamarin_94f0906f.zip


SS SaiGanesh Sakthivel Syncfusion Team March 23, 2021 04:19 PM UTC

Hi Mohammed,

Thank you for the update.

Regarding Smooth scrolling in ScrollView with Horizontal SFListView
We have checked the reported scenario at our side. We could reproduce the reported issue occurs after updating to the Xamarin.Forms v4.5 where Xamarin migrated AndroidX.  
 
  
We would like to inform you that we are using NestedScrollingEnabled as True in our source to enable the ListView scrolling when loaded in the ScrollView. Also, you can overcome the reported scenario by setting the NestedScrollingEnabled as False in sample level. Please refer to the following code snippets for more reference,  
  
Write dependency interface in the PCL project   
public interface IDependencyServiceListView  
{  
    void SetNestedScrollingEnabled(SfListView ListView);  
}  
 
Implement the interface and set the NestedScrollingEnabled for the renderer in the native android project.  
[assembly: Dependency(typeof(ListViewDependencyService))]  
namespace ListViewXamarin.Droid   
{   
    public class ListViewDependencyService : IDependencyServiceListView   
    {   
        ExtendedScrollView ExtendedScrollView;  
  
        public void SetNestedScrollingEnabled(SfListView ListView)  
        {  
#if __ANDROID_29__  
            ExtendedScrollView = ListView.GetScrollView();  
            var extendedScrollViewRenderer = Platform.GetRenderer(ExtendedScrollView);  
            extendedScrollViewRenderer.View.NestedScrollingEnabled = false;  
#endif  
        }  
    }   
 
  
In the OnAppearing override, call the dependency method for the ListView to update the API.  
protected override void OnAppearing()  
 
    base.OnAppearing();  
  
   if (Device.RuntimePlatform == Device.Android) 
    { 
    DependencyService.Get<IDependencyServiceListView>().SetNestedScrollingEnabled(listView); 
     
 
  
Also, set the IsScrollingEnabled as False for the ListView to load the ListView with full height.  
<syncfusion:SfListView Grid.Row="1" 
                        x:Name="listView" 
                        ItemSize="150" 
                        IsScrollingEnabled="False" 
                        Orientation="Horizontal" 
                        ItemsSource="{Binding contactsinfo}"> 
    <syncfusion:SfListView.ItemTemplate> 
     
 
We have attached the sample for your requirement and updated in the following link,  
 
Please let us know if you have any concern.

Regards,
SaiGanesh Sakthivel
 



KA Karro March 23, 2021 06:51 PM UTC

Hi SaiGanesh,
I have checked your instructions and it works on the sample. however in my scenario I have the ListView inside a ContentView and not inside a Page so I have no access to the ListView from the Page code, I also don't  have the base methode "OnAppearing()" on the ContentViews code to override.


Thank you


SS SaiGanesh Sakthivel Syncfusion Team March 24, 2021 09:03 AM UTC

Hi Mohammed,

Thank you for the update.

#Regarding Smooth scrolling in ScrollView with Horizontal SFListView 
 
We have checked the reported query from our side. We suggest you to try the Loaded event instead of ItemAppearing to achieve your requirement. The Loaded event will be raised after the SfListView is loaded in view for the first time. You can trigger the Loaded event for each ListView loaded in the page and call the SetNestedScrollingEnable method.    
   
Please refer to the user guidance document from the following link,   
   
Please refer to the following code snippet for your reference.  
private void listView_Loaded(object sender, Syncfusion.ListView.XForms.ListViewLoadedEventArgs e)  
 
    if (Device.RuntimePlatform == Device.Android)  
    {  
        DependencyService.Get<IDependencyServiceListView>().SetNestedScrollingEnabled(listView);  
    }  
 
 
Please refer to the tested sample in the following link for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ListViewXamarin-1401444570 
 
  
Please let us know if you have any concern.

Regards,
SaiGanesh Sakthivel
 


Marked as answer

KA Karro March 24, 2021 09:19 PM UTC

Hi SaiGanesh,
Thank you a lot. Your suggestion works fine, the scrolling is now as expected.

Best Regards


SS SaiGanesh Sakthivel Syncfusion Team March 25, 2021 06:35 AM UTC

Hi Mohammed,
  
Thank you for the update.  
  
We are glad to know that the provided solution is resolved the issue. Please let us know if you need any further assistance.  
 
Regards,  
SaiGanesh Sakthivel 



BA Bala May 29, 2021 02:13 PM UTC

Hi, 

Is this solution also suitable for solve trouble in scrolling vertical SfListview inside Scrollview?

 <ScrollView Grid.Row="0"
                            VerticalOptions="FillAndExpand">

                   
                    <listView:SfListView  
                                                 x:Name="sflv_conversations"
                                                 AllowSwiping="True"
                                                 AutoFitMode="DynamicHeight"
                                                 FocusBorderThickness="0"
                                                 BackgroundColor="White"
                                                 ItemsSource="{Binding Conversations}"
                                                 SelectionGesture="Tap"
                                                 IsScrollingEnabled="False"
                                                 SelectionMode="Single"
                                                 SwipeOffset="156"
                                                 TapCommand="{Binding ItemSelectedCommand}"
                                                 VerticalOptions="FillAndExpand"
                                                 ListViewCachingStrategy="RecycleTemplate"
                                                 ItemsSourceChangeCachingStrategy="ClearItems">



LN Lakshmi Natarajan Syncfusion Team May 31, 2021 10:13 AM UTC

Hi Bala, 
 
Thank you for using Syncfusion products. 
 
We would like to inform you that the scrolling issue occurs when using Android Target platform version as Android 10.0 (Q). As we have mentioned above, you can resolve the issue “trouble in scrolling vertical SfListview inside Scrollview” by using the above provided solution. 
 
Please let us know if you need further assistance. 
 
Regards, 
Lakshmi Natarajan 



BA Bala May 31, 2021 11:00 AM UTC

Hi Lakshmi,

The solution worked. Thanks for your support. 


LN Lakshmi Natarajan Syncfusion Team May 31, 2021 11:56 AM UTC

Hi Bala, 
 
Thank you for the update. 
 
We are glad that your requirement has been met at your side. Please let us know if you need further assistance. As always we are happy to help you out. 
 
Lakshmi Natarajan 
 


Loader.
Up arrow icon