void RemoveTabBarHeightListener(BottomNavigationView bottomNavView) { if (null != tabBarLayoutChangeListener) { bottomNavView?.RemoveOnLayoutChangeListener(tabBarLayoutChangeListener); tabBarLayoutChangeListener.HeightChanged -= HandleTabBarHeightChanged; tabBarLayoutChangeListener.Dispose(); tabBarLayoutChangeListener = null; } }
int CaculateTabHeight(BottomNavigationView bottomNavView) { var xfView = renderer.Element; var tabHeight = TabEffect.GetCustomTabHeight(Element); int viewHeight = 0; var formViewHeight = xfView.HeightRequest; if (null == tabHeight) { viewHeight = (int)Container.Context.ToPixels(xfView.HeightRequest); } else if (tabHeight.Mode == TabHeightMode.Absolute) { viewHeight = (int)Container.Context.ToPixels(tabHeight.Value); formViewHeight = tabHeight.Value; } else if (bottomNavView != null) { if (tabHeight.Mode == TabHeightMode.RelativeToNativeTabBar) { viewHeight = (int)Math.Round((double)bottomNavView.Height + Container.Context.ToPixels(tabHeight.Value)); formViewHeight = Container.Context.FromPixels(bottomNavView.Height) + tabHeight.Value; } else { viewHeight = (int)Math.Round((double)bottomNavView.Height * tabHeight.Value); formViewHeight = Container.Context.FromPixels((double)bottomNavView.Height * tabHeight.Value); } tabBarLayoutChangeListener = new TabBarLayoutChangeListener(); tabBarLayoutChangeListener.HeightChanged += HandleTabBarHeightChanged; bottomNavView.AddOnLayoutChangeListener(tabBarLayoutChangeListener); } if (bottomNavView != null) { renderer.Layout(0, 0, bottomNavView.Width, viewHeight); xfView.Layout(new Rectangle(0, 0, Container.Context.FromPixels(bottomNavView.Width), formViewHeight)); } return(viewHeight); }