Xamarin.forms: [Bug] Android Entry on appearing weird effect upon Forms 4.4

Created on 20 Dec 2019  路  10Comments  路  Source: xamarin/Xamarin.Forms

Description

After upgrading forms from 4.3 to 4.4 all android entries now show an ugly fading indicator upon page appearing. In different projects, different layouts and pages, with or without any custom renderer, the only thing that made that happend was forms 4.4, on 4.3 it's all fine.

You can see animated gif and get more info here:
https://forums.xamarin.com/discussion/comment/398840

Repro project is here:
https://github.com/taublast/droidentrybug

Steps to Reproduce

run repro project

or

  1. put entry inside frame with a scrollview above using forms 4.4
  2. open this page

Expected Behavior

as in Forms 4.3 and below, nothing special.

Actual Behavior

a wierd fading out rectangle upon apearing

Basic Information

  • Version with issue:
    forms 4.4

  • Last known good version:

forms 4.3

  • IDE:
    VS 2019

  • Platform Target Frameworks:

    • Android: compiled vs 9.0
  • Affected Devices:
    tested on Android emulators api 23 (6.0) and api 25

Screenshots

https://us.v-cdn.net/5019960/uploads/editor/mf/oewnktd9pug2.gif
https://us.v-cdn.net/5019960/uploads/editor/p4/cxpw3ulizwmk.gif

more here: https://forums.xamarin.com/discussion/comment/398840

Reproduction Link

https://github.com/taublast/droidentrybug

4.4.0 3 regression in-progress Android bug

Most helpful comment

Work Around

As a workaround, in your Android project, add a custom renderer and set Control.VerticalScrollBarEnabled = false;.

I added this Label custom renderer recommended here to solve the problem for Labels in my app.

Here's the complete source code, for reference: https://github.com/brminnick/GitTrends

using Android.Content;
using GitTrends.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

//workaround for this issue: https://github.com/xamarin/Xamarin.Forms/issues/8626 and https://github.com/xamarin/Xamarin.Forms/issues/8986

[assembly: ExportRenderer(typeof(Label), typeof(LabelCustomRenderer))]
namespace GitTrends.Droid
{
    class LabelCustomRenderer : Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer
    {
        public LabelCustomRenderer(Context context) : base(context)
        {

        }

        protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
        {
            base.OnElementChanged(e);

            if (Control is null || e.NewElement is null)
                return;

            Control.VerticalScrollBarEnabled = false;
        }
    }
}

| IsRefreshing is true | While Scrolling | Not Refreshing or Scrolling |
| ----------------------- | --------------- | ------------------ |
Screenshot_1583082257 | Screenshot_1583082262 | Screenshot_1583082259 |

All 10 comments

Interesting. Seems to be linked to #8626, but clearly it's not exclusive to CollectionView and the linked issue also already shows in 4.3.

Verified that this shows in the reproduction. Only in a ScrollView (or similar) though.

I observe the same glitch on v. 4.4. I checked it on Samsung devices API26/API27. I see this glitch on some labels as well.
It worked well on v. 4.3. iOS works well on v. 4.4.
Rolled back to 4.3 for now.

I can confirm this happens with Labels as well. A solid bar is visible, which then animates down to the bottom of the view over the course of ~1.5s (instead of upwards as seen in OP's GIF).

did anyone find a fix for this? I have the same issue happening inside a collectionview but with forms9patch

just use forms 4.3

When is this issue expected to be fixed? Currently, I cannot update to the latest version of Xamarin.Forms because of it.
Downgrading to 4.3 is also not an appropriate solution because there are fixes in 4.4 that I need.

Same problem with Forms 4.4.0.991640 and Labels.

Working:

  • ListView

Not working:

  • CollectionView
  • BindableLayout (StackLayout)

Screenshot_20200210-124220_Dtonestro - learn Recorder

I am having the same problem on 4.5.0.266-pre3. Labels in CollectionView and BindableLayout (StackLayout).

I can confirm this is still exists in v4.5.0.356 when using a CollectionView

Here's a reproduction:

  • Download/clone this repo: https://github.com/brminnick/GitTrends/tree/Android-Label-Vertical-Scroll-Bars-Repro
  • Run GitTrends.Android on an Android Emulator or Device
  • In the GitTrends app, navigate to the Settings page
  • On the Settings page, connect to your GitHub Account (or tap ENTER DEMO MODE if you don't want to connect to your GitHub account)

    • In the GitTrends app, navigate back to the main page, titled Repositories

    • In the GiTrends app, ensure the CollectionView inside of a RefreshView is refreshing (if not, execute a pull-to-refresh)

    • As the RefreshView is refreshing, confirm the effect appears

    • Once the RefreshView finishes refreshing, confirm the effect has disappeared

    • On the Repositories page, scroll the list

    • While the list is scrolling, confirm the effect appears

    • Once the scrolling stops, confirm the effect has disappeared

| IsRefreshing is true | While Scrolling | Not Refreshing or Scrolling |
| ----------------------- | --------------- | --------------------------- |
| Screenshot_1583081198 | Screenshot_1583081270 | Screenshot_1583081203 |

Work Around

As a workaround, in your Android project, add a custom renderer and set Control.VerticalScrollBarEnabled = false;.

I added this Label custom renderer recommended here to solve the problem for Labels in my app.

Here's the complete source code, for reference: https://github.com/brminnick/GitTrends

using Android.Content;
using GitTrends.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

//workaround for this issue: https://github.com/xamarin/Xamarin.Forms/issues/8626 and https://github.com/xamarin/Xamarin.Forms/issues/8986

[assembly: ExportRenderer(typeof(Label), typeof(LabelCustomRenderer))]
namespace GitTrends.Droid
{
    class LabelCustomRenderer : Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer
    {
        public LabelCustomRenderer(Context context) : base(context)
        {

        }

        protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
        {
            base.OnElementChanged(e);

            if (Control is null || e.NewElement is null)
                return;

            Control.VerticalScrollBarEnabled = false;
        }
    }
}

| IsRefreshing is true | While Scrolling | Not Refreshing or Scrolling |
| ----------------------- | --------------- | ------------------ |
Screenshot_1583082257 | Screenshot_1583082262 | Screenshot_1583082259 |

Was this page helpful?
0 / 5 - 0 ratings