Xamarin.forms: Xamarin scrollview overlaps other content when scrolling

Created on 31 Jan 2020  路  9Comments  路  Source: xamarin/Xamarin.Forms

Description

this only occurs on android scroll view content overlaps other contents that are above the scrollview control

Steps to Reproduce

  1. create a page with stack layout and scrollview
  2. put any controls ion the scroll view
  3. scroll up and see that the content of the scroll view is overlap the stacklayout that is before the scrollview

Expected Behavior

should not overlap any other content in the screen

Actual Behavior

it overlap other controls in the screen

Basic Information

  • Version with issue: all versions
  • Last known good version:
  • IDE: vs 2019
  • Platform Target Frameworks:

    • iOS: working good on all versions

    • Android: all versions

  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:
layout scrollview Android unverified bug

Most helpful comment

something very strange, I finally found the cause of this problem
in the android mainfest file the application tag :

<application android:label="@string/app_name" android:largeHeap="true" android:hardwareAccelerated="false" android:supportsRtl="true">

A package (not by me or the team) has changed it and added this att: android:hardwareAccelerated="false" and after that the problem occurred when remove it or change its value to true it works like a charm
I have a doubt that android Android.Glide.Forms.Init(this) has something with this.

All 9 comments

This is urgent please, we are stopped and can't push our new version of the application to the store because of that !! this is something very basic and should be fixed ASASP please

@motasemloubani91 Can you please attach a small project that demonstrates this issue? Thanks!

I believe that there is a conflict because I have created a new project with almost same conditions as mine but it is working in the new one! and I have seen many others are struggling from the same issue, so, I think that it may be a conflict between another package

here is a test page inside my project

`
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Dokkan.Views.Page1">


            </StackLayout>
        </ScrollView>
    </StackLayout>
</ContentPage.Content>

`


here is the android on create method (I disabled any third party package)

` protected override void OnCreate(Bundle bundle)
{
//logger = AppEventsLogger.NewLogger(this);
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(bundle);
        //AppCenter.Start("fb7ef0ad-41e0-481b-9d05-203b3927879b", typeof(Analytics), typeof(Crashes)); 
        //FacebookSdk.FullyInitialize();

        //Rg.Plugins.Popup.Popup.Init(this, bundle);
        //ZXing.Net.Mobile.Forms.Android.Platform.Init();
        global::Xamarin.Forms.Forms.Init(this, bundle);
        Xamarin.FormsMaps.Init(this, bundle);
        //App.ExtraTopMargin = 0;
        //App.ScreenHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);
        //App.ScreenWidth = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);
        //CrossCurrentActivity.Current.Activity = this;
        //FFImageLoading.Forms.Platform.CachedImageRenderer.Init(false);
        //UserDialogs.Init(this);
        //CrossCurrentActivity.Current.Init(this, bundle);
        //Xamarin.FormsGoogleMaps.Init(this, bundle); // initialize for    
        //Android.Glide.Forms.Init(this);
        LoadApplication(new App());
    }`

here is a video of what is going on : https://filebin.net/0mzbla3zut2j55jh/20200201_003520.mp4?t=r72xwt7g

the red labels are in a stack layout with the scroll view
the scroll view contains a list of labels
the white label which are in the scroll view are overlapping the red ones when scrolling

another case if there is another layout after the scrollview :


xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
BackgroundColor="Brown"
x:Class="Dokkan.Views.Page1">






            </StackLayout>
        </ScrollView>
        <StackLayout BackgroundColor="White">
            <Label Text="Welcome to Xamarin.Forms!"
            VerticalOptions="CenterAndExpand" 
            HorizontalOptions="CenterAndExpand" 
               TextColor="Red"
               />
            <Label Text="Welcome to Xamarin.Forms!"
            VerticalOptions="CenterAndExpand" 
            HorizontalOptions="CenterAndExpand" 
               TextColor="Red"
               />
            <Label Text="Welcome to Xamarin.Forms!"
            VerticalOptions="CenterAndExpand" 
            HorizontalOptions="CenterAndExpand" 
               TextColor="Red"
               />
            <Label Text="Welcome to Xamarin.Forms!"
            VerticalOptions="CenterAndExpand" 
            HorizontalOptions="CenterAndExpand" 
               TextColor="Red"
               />
        </StackLayout>
    </StackLayout>
</ContentPage.Content>

Video link: https://filebin.net/1flkcfzq05n76uei/20200201_004532.mp4?t=2z0npauv

here is the code if not clear up: https://controlc.com/0c8ebad4

please we need to fix this ASAP as we are facing many issues from all of our users who use android

by the way, there are many users who are facing the same issue, so I am not sure where is the problem because it is working as expected in a pure xamarin forms project and it was do in the previous on our project.

here is some links of users who are struggling
https://forums.xamarin.com/discussion/20945/scrollview-in-xaml/p2
https://github.com/xamarin/Xamarin.Forms/issues/3535
and many others

something very strange, I finally found the cause of this problem
in the android mainfest file the application tag :

<application android:label="@string/app_name" android:largeHeap="true" android:hardwareAccelerated="false" android:supportsRtl="true">

A package (not by me or the team) has changed it and added this att: android:hardwareAccelerated="false" and after that the problem occurred when remove it or change its value to true it works like a charm
I have a doubt that android Android.Glide.Forms.Init(this) has something with this.

something very strange, I finally found the cause of this problem
in the android mainfest file the application tag :

<application android:label="@string/app_name" android:largeHeap="true" android:hardwareAccelerated="false" android:supportsRtl="true">

A package (not by me or the team) has changed it and added this att: android:hardwareAccelerated="false" and after that the problem occurred when remove it or change its value to true it works like a charm
I have a doubt that android Android.Glide.Forms.Init(this) has something with this.

So weird, but saved my life

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dannythomas13 picture dannythomas13  路  56Comments

hartez picture hartez  路  55Comments

jassmith picture jassmith  路  199Comments

juepiezhongren picture juepiezhongren  路  66Comments

JasonLooney picture JasonLooney  路  55Comments