如何在Xamarin.Forms(iOS)中更改Tab栏的高度?TabbedRenderer可以吗?
是的,这可以从a修改CustomRenderer
.
您需要TabbedPage
在Forms项目中继承子类并使用此类导出渲染.
然后在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); } }
希望这可以帮助.-