[英]How to change Xamarin.Forms Tab Bar height (iOS)
How to change the height of a Tab Bar in Xamarin.Forms (iOS)? 如何在Xamarin.Forms(iOS)中更改Tab栏的高度? Is it possible with TabbedRenderer?
TabbedRenderer可以吗?
Yeah this is possible to modify from a CustomRenderer
. 是的,可以从
CustomRenderer
修改。
You will need to subclass the TabbedPage
in the Forms project and use this class to export the render. 您需要在Forms项目中
TabbedPage
并使用此类导出渲染。
Then in the CustomRenderer override the ViewWillLayoutSubviews
method. 然后在CustomRenderer中覆盖
ViewWillLayoutSubviews
方法。 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.- 希望这可以帮助。-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.