question

DanRob-9330 avatar image
0 Votes"
DanRob-9330 asked RobCaplan edited

Flicker when transitioning pages in TabbedPages

Good day, I am working on an app with TabbedPages, when I use PushAsync to nagivate to a different ContentPage, there is a very noticeable and distracting flicker between page transitions. The Tabs go toward the center of the screen, freeze for a very short time, then there's a blank screen that flickers and then the new page is loaded. I know this is a known problem, and have searched through several forum posts and tried their suggestions, but nothing has worked for me up to now. Most posts I've found are a bit older and use a MasterDetailPage, which I am not using. I have tried optimizing performance in everyway I can and is recommended, I have XamlCompile enabled throughout my app, and have all my UI elements in XAML and not in Code-behind, my methods are async/await; I've spent hours trying to solve this, but I find no solution. I am developing for Android, and have tested in on multiple physical and emulated devices, they all present the same issue. Any tips/suggestions would be greatly appreciated.

Some things I have tried that have worked for other people, but unfortunately not for me:

 var page = new AboutAppPage();
    
 Device.BeginInvokeOnMainThread(() =>
 {
 App.NavigateToPage(page);
 });

//In App class:

     public static NavigationPage MainNavPage { get; set; }

     public async static void NavigateToPage(Page page)
     {
         await MainNavPage.PushAsync(page, true);
     }

//

 ////////////////////
    
 var page = new AboutAppPage();
                
 await Navigation.PushAsync(page, true);
    
 ////////////////////
    
 Task.Factory.StartNew(() =>
 {
     var newPage = new ThemeOptionsPage();
     return newPage;
 }).ContinueWith(tnp => { Navigation.PushAsync(tnp.Result); });
    
    
 ///////////////////
    
 Task<ThemeOptionsPage> taskA = Task.Run(() => new ThemeOptionsPage());
    
 taskA.ContinueWith(antecedent => App.NavigateToPage(antecedent.Result));


These are called from a ContentPage that's a child of my TabbedPage.
Some of the pages I am calling, are very simple with just a few labels and they still experience the flicker, so I am fairly certain the problem is not with the complexity of the pages.

Thanks in advance!

dotnet-csharpdotnet-xamarin
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Here is a video showing what I mean, sometimes it's more noticeable than others.

101666-flicker-in-app-physical-device-gif.gif



0 Votes 0 ·

I did a test ,but I couldn't reproduce this problem. Could you please post a basic demo to github or onedriver so that we can test on our side?

0 Votes 0 ·

@JessieZhang-2116
Thank you for your comment, I did a quick demo, but I was unfortunately unable to reproduce it in the demo. It seems its its somehow tied to my project, but I am navigating between pages in the appropriate way and how I've done it successfully in other apps, and this happens even on my very light pages. Any thoughts what could be the cause?

0 Votes 0 ·

This flicker/lag does not happen when I do PushModalAsync, however some of my pages do not qualify for modality and such it is unfortunately not a suitable solution for my problem.

0 Votes 0 ·

What's the version of your xamarin forms nuget? You can try to update it to the latest version and try again.

0 Votes 0 ·
Show more comments

0 Answers