locked
How to disable swipe on TabbedPage in Android? RRS feed

  • Question

  • User235839 posted

    I'm looking for a way to disable my TabbedPage switching tabs on swiping. Is this possible? Any help appreciated.

    Tuesday, December 20, 2016 2:35 AM

Answers

  • User181338 posted

    https://forums.xamarin.com/discussion/65212/disable-tabbed-page-swiping-when-using-formsappcompatactivity

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, December 20, 2016 10:57 AM

All replies

  • User181338 posted

    https://forums.xamarin.com/discussion/65212/disable-tabbed-page-swiping-when-using-formsappcompatactivity

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, December 20, 2016 10:57 AM
  • User235839 posted

    Thanks, Ninja Focks. Max's solution worked for me perfectly.

    ``` using System; using Xamarin.Forms.Platform.Android.AppCompat; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using System.Reflection;

    [assembly: ExportRenderer(typeof(TabbedPage), typeof(TabViewTest.Droid.CustomTabbedRenderer))]

    namespace TabViewTest.Droid { public class CustomTabbedRenderer : TabbedPageRenderer { protected override void OnElementChanged(ElementChangedEventArgs e) { base.OnElementChanged(e);

            var propInfo = typeof (TabbedPageRenderer).GetProperty("UseAnimations", BindingFlags.Instance | BindingFlags.NonPublic);
            propInfo.SetValue(this, false);
        }
    }
    

    } ```

    Wednesday, December 21, 2016 2:39 AM
  • User181338 posted

    Great :)

    Wednesday, December 21, 2016 8:31 AM