Ejemplo n.º 1
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            int width  = r - l;
            int height = b - t;

            var context = Context;

            _bottomBar.Measure(MeasureSpecFactory.MakeMeasureSpec(width, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(height, MeasureSpecMode.AtMost));
            int tabsHeight = Math.Min(height, Math.Max(_bottomBar.MeasuredHeight, _bottomBar.MinimumHeight));

            if (width > 0 && height > 0)
            {
                _pageController.ContainerArea = new Rectangle(0, 0, context.FromPixels(width), context.FromPixels(_frameLayout.MeasuredHeight));
                ObservableCollection <Element> internalChildren = _pageController.InternalChildren;

                for (var i = 0; i < internalChildren.Count; i++)
                {
                    var child = internalChildren[i] as VisualElement;

                    if (child == null)
                    {
                        continue;
                    }

                    IVisualElementRenderer renderer = Platform.GetRenderer(child);
                    var navigationRenderer          = renderer as NavigationPageRenderer;
                }

                _bottomBar.Measure(MeasureSpecFactory.MakeMeasureSpec(width, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(tabsHeight, MeasureSpecMode.Exactly));
                _bottomBar.Layout(0, 0, width, tabsHeight);
            }

            base.OnLayout(changed, l, t, r, b);
        }
Ejemplo n.º 2
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            int width  = r - l;
            int height = b - t;

            //   height = 2280;

            _bottomBar.HideShadow();

            var context = Context;

            _bottomBar.Measure(MeasureSpecFactory.MakeMeasureSpec(width, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(height, MeasureSpecMode.AtMost));
            int tabsHeight = Math.Min(height, Math.Max(_bottomBar.MeasuredHeight, _bottomBar.MinimumHeight));

            //if(changedTabsHeight!=tabsHeight)
            //{
            //    if(changedTabsHeight!=0)
            //    {
            //        if (changedTabsHeight > tabsHeight)
            //        {
            //            _bottomBar.Hide(false);
            //        }
            //        else
            //        {
            //            _bottomBar.Show(false);
            //        }
            //    }

            //    changedTabsHeight = tabsHeight;
            //}

            if (width > 0 && height > 0)
            {
                _pageController.ContainerArea = new Rectangle(0, 0, context.FromPixels(width), context.FromPixels(_frameLayout.MeasuredHeight));
                ObservableCollection <Element> internalChildren = _pageController.InternalChildren;

                for (var i = 0; i < internalChildren.Count; i++)
                {
                    var child = internalChildren [i] as VisualElement;

                    if (child == null)
                    {
                        continue;
                    }

                    IVisualElementRenderer renderer = Platform.GetRenderer(child);
                    var navigationRenderer          = renderer as NavigationPageRenderer;
                    if (navigationRenderer != null)
                    {
                        // navigationRenderer.ContainerPadding = tabsHeight;
                    }
                }

                _bottomBar.Measure(MeasureSpecFactory.MakeMeasureSpec(width, MeasureSpecMode.Exactly), MeasureSpecFactory.MakeMeasureSpec(tabsHeight, MeasureSpecMode.Exactly));
                _bottomBar.Layout(0, 0, width, tabsHeight);
            }

            base.OnLayout(changed, l, t, r, b);

            //for (int i = 0; i < _bottomBar.ItemContainer.ChildCount; i++)
            //{
            //    var bottomBarTab = _bottomBar.ItemContainer.GetChildAt(i);
            //    var tabIcon = bottomBarTab.FindViewById<Android.Support.V7.Widget.AppCompatImageView>(BottomNavigationBar.Resource.Id.bb_bottom_bar_icon);
            //    tabIcon.SetScaleType(ImageView.ScaleType.);
            //    tabIcon.ScaleX = 0.0f;
            //    tabIcon.ScaleY = 0.0f;
            //}
        }