繁体   English   中英

如何更改Xamarin.Forms标签栏高度(iOS)

[英]How to change Xamarin.Forms Tab Bar height (iOS)

如何在Xamarin.Forms(iOS)中更改Tab栏的高度? TabbedRenderer可以吗?

是的,可以从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);
    }
}

希望这可以帮助。-

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM