Jaa


TabbedPage Page Transition Animations on Android

This Android platform-specific is used to disable transition animations when navigating through pages, either programmatically or when using the tab bar, in a TabbedPage. It's consumed in XAML by setting the TabbedPage.IsSmoothScrollEnabled bindable property to false:

<TabbedPage ...
            xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
            android:TabbedPage.IsSmoothScrollEnabled="false">
    ...
</TabbedPage>

Alternatively, it can be consumed from C# using the fluent API:

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
...

On<Android>().SetIsSmoothScrollEnabled(false);

The TabbedPage.On<Android> method specifies that this platform-specific will only run on Android. The TabbedPage.SetIsSmoothScrollEnabled method, in the Xamarin.Forms.PlatformConfiguration.AndroidSpecific namespace, is used to control whether transition animations will be displayed when navigating between pages in a TabbedPage. In addition, the TabbedPage class in the Xamarin.Forms.PlatformConfiguration.AndroidSpecific namespace also has the following methods:

  • IsSmoothScrollEnabled, which is used to retrieve whether transition animations will be displayed when navigating between pages in a TabbedPage.
  • EnableSmoothScroll, which is used to enable transition animations when navigating between pages in a TabbedPage.
  • DisableSmoothScroll, which is used to disable transition animations when navigating between pages in a TabbedPage.