3
如何更改Xamarin.Forms(iOS)中标签栏的高度? TabbedRenderer可能吗?如何更改Xamarin.Forms标签栏高度(iOS)
如何更改Xamarin.Forms(iOS)中标签栏的高度? TabbedRenderer可能吗?如何更改Xamarin.Forms标签栏高度(iOS)
是的,这是可以从CustomRenderer
修改。
您将需要继承Forms项目中的TabbedPage
并使用此类导出渲染。
然后在CustomRenderer中覆盖ViewWillLayoutSubviews
方法。喜欢的东西:
public class MyTabbedPageRenderer : TabbedRenderer
{
// Modify this variable with the height you desire.
private readonly float tabBarHeight = 55f;
public override void ViewWillLayoutSubviews()
{
base.ViewWillLayoutSubviews();
TabBar.Frame = new CGRect(TabBar.Frame.X, TabBar.Frame.Y + (TabBar.Frame.Height - tabBarHeight), TabBar.Frame.Width, tabBarHeight);
}
}
希望这helps.-
它完美!谢谢你的帮助! – Josh