protected override void OnElementChanged(ElementChangedEventArgs <BottomBarPage> e) { base.OnElementChanged(e); if (e.NewElement != null) { _bottomBar = (BottomNavigationBar.BottomBar) this.GetChildAt(0); _bottomBar.SetOnTabClickListener(this); } }
protected override void OnElementChanged (ElementChangedEventArgs<BottomBarPage> e) { base.OnElementChanged (e); if (e.NewElement != null) { BottomBarPage bottomBarPage = e.NewElement; if (_bottomBar == null) { _pageController = PageController.Create (bottomBarPage); // create a view which will act as container for Page's _frameLayout = new FrameLayout (Forms.Context); _frameLayout.LayoutParameters = new FrameLayout.LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent, GravityFlags.Fill); AddView (_frameLayout, 0); // create bottomBar control _bottomBar = BottomNavigationBar.BottomBar.Attach (_frameLayout, null); _bottomBar.NoTabletGoodness (); if (bottomBarPage.FixedMode) { _bottomBar.UseFixedMode (); } switch (bottomBarPage.BarTheme) { case BottomBarPage.BarThemeTypes.Light: break; case BottomBarPage.BarThemeTypes.DarkWithAlpha: _bottomBar.UseDarkThemeWithAlpha (true); break; case BottomBarPage.BarThemeTypes.DarkWithoutAlpha: _bottomBar.UseDarkThemeWithAlpha (false); break; default: throw new ArgumentOutOfRangeException (); } _bottomBar.LayoutParameters = new LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent); _bottomBar.SetOnTabClickListener (this); UpdateTabs (); UpdateBarBackgroundColor (); UpdateBarTextColor (); } if (bottomBarPage.CurrentPage != null) { SwitchContent (bottomBarPage.CurrentPage); } } }
protected override void OnElementChanged(ElementChangedEventArgs <BottomBarPage> e) { base.OnElementChanged(e); if (e.NewElement != null) { _bottomBar = (BottomNavigationBar.BottomBar) this.GetChildAt(0); //var frameLayout = _bottomBar.FindViewById<FrameLayout>(Resource.Id.bb_user_content_container); //var view = new TextView(this.Context); //view.Text = "test"; //view.LayoutParameters = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.WrapContent); //frameLayout.AddView(view,0); //var items = frameLayout.GetChildAt(1); //items.LayoutParameters = new Android.Widget.FrameLayout.LayoutParams(Android.Widget.FrameLayout.LayoutParams.MatchParent, Android.Widget.FrameLayout.LayoutParams.MatchParent) { TopMargin = DpToPixel(this.Context, 56) }; _bottomBar.SetOnTabClickListener(this); } }
protected override void Dispose (bool disposing) { if (disposing && !_disposed) { _disposed = true; RemoveAllViews (); foreach (Page pageToRemove in Element.Children) { IVisualElementRenderer pageRenderer = Platform.GetRenderer (pageToRemove); if (pageRenderer != null) { pageRenderer.ViewGroup.RemoveFromParent (); pageRenderer.Dispose (); } pageToRemove.PropertyChanged -= OnPagePropertyChanged; // pageToRemove.ClearValue (Platform.RendererProperty); } if (_badges != null) { _badges.Clear (); _badges = null; } if (_bottomBar != null) { _bottomBar.SetOnTabClickListener (null); _bottomBar.Dispose (); _bottomBar = null; } if (_frameLayout != null) { _frameLayout.Dispose (); _frameLayout = null; } /*if (Element != null) { PageController.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged; }*/ } base.Dispose (disposing); }