带有 FreshTabbedNavigationContainer 的可滚动标签栏

Scrollable tab bar with FreshTabbedNavigationContainer

使用 FreshMVVM 的 FreshTabbedNavigationContainer 所有选项卡都希望同时可见并被截断:

我希望它们像常规一样全宽且可滚动 TabbedPage:

我实际上没有那么多标签。这只是一个例子来说明我的意思。

您需要使用 CustomRednerer。
例如:
在 Droid 项目中:

[assembly: ExportRenderer(typeof(ScrollableTabbedPage), typeof(ScrollableTabbedPageRenderer))]
namespace ScrollableFreshTabbed.Droid
{
    class ScrollableTabbedPageRenderer : TabbedPageRenderer
    {
        public ScrollableTabbedPageRenderer(Context context) : base(context)
        {

        }
        public override void OnViewAdded(Android.Views.View child)
        {
            base.OnViewAdded(child);
            var tabLayout = child as TabLayout;
            if (tabLayout != null)
            {
                tabLayout.TabMode = TabLayout.ModeScrollable;
            }
        }    
    }
}

在便携式项目中:

public class ScrollableTabbedPage :  FreshTabbedNavigationContainer
{
    public ScrollableTabbedPage ()
    {

    }
}

App.xaml.cs:

        public App ()
        {
            InitializeComponent();
            var tabbedNavigation = new ScrollableTabbedPage();
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);
            tabbedNavigation.AddTab<QuotePageModel>("Contacts", null);

            MainPage = tabbedNavigation;    
        }

结果是: