简体   繁体   中英

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

How to change the height of a Tab Bar in Xamarin.Forms (iOS)? Is it possible with TabbedRenderer?

Yeah this is possible to modify from a CustomRenderer .

You will need to subclass the TabbedPage in the Forms project and use this class to export the render.

Then in the CustomRenderer override the ViewWillLayoutSubviews method. Something like:

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);
    }
}

Hope this helps.-

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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