使用 Xamarin.Forms Shell 时主选项卡能否出现在顶部
Can primary tabs appear at the top when using Xamarin.Forms Shell
客户希望 iOS 的主选项卡显示在底部,Android 的主选项卡显示在顶部。这在使用 Shell 时可能吗?我知道 nested/secondary 选项卡可以出现在顶部,但我再次指的是 primary/top-level 选项卡。 Shell 是否强制主选项卡始终位于底部选项卡,或者是否有办法将它们也显示在顶部?
抱歉,Shell强制主标签始终在底部,我们无法修改。
shell标签栏的布局设计为默认。你可以在这里查看 source code of Shell :
public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (_shellContent != null)
{
_page = ((IShellContentController)_shellContent).GetOrCreateContent();
}
_root = inflater.Inflate(Resource.Layout.ShellContent, null).JavaCast<CoordinatorLayout>();
//here layout be designed as default
_toolbar = _root.FindViewById<Toolbar>(Resource.Id.shellcontent_toolbar);
_renderer = Platform.CreateRenderer(_page, Context);
Platform.SetRenderer(_page, _renderer);
...
return _root;
}
最后如您所说,建议不要使用 Shell 来实现。
客户希望 iOS 的主选项卡显示在底部,Android 的主选项卡显示在顶部。这在使用 Shell 时可能吗?我知道 nested/secondary 选项卡可以出现在顶部,但我再次指的是 primary/top-level 选项卡。 Shell 是否强制主选项卡始终位于底部选项卡,或者是否有办法将它们也显示在顶部?
抱歉,Shell强制主标签始终在底部,我们无法修改。
shell标签栏的布局设计为默认。你可以在这里查看 source code of Shell :
public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (_shellContent != null)
{
_page = ((IShellContentController)_shellContent).GetOrCreateContent();
}
_root = inflater.Inflate(Resource.Layout.ShellContent, null).JavaCast<CoordinatorLayout>();
//here layout be designed as default
_toolbar = _root.FindViewById<Toolbar>(Resource.Id.shellcontent_toolbar);
_renderer = Platform.CreateRenderer(_page, Context);
Platform.SetRenderer(_page, _renderer);
...
return _root;
}
最后如您所说,建议不要使用 Shell 来实现。