对于FreshMVVM的FreshTabbedNavigationContainer,所有选项卡都希望同时可见并截断:

我希望它们是全宽度的,并且像普通的TabbedPage一样可以滚动。

我其实没有那么多标签。这只是一个例子来说明我的意思。
发布于 2018-04-16 07:36:37
您需要使用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;
}结果是:

https://stackoverflow.com/questions/49811022
复制相似问题