示例#1
0
        public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            _outerLayout    = inflater.Inflate(Resource.Layout.bottomtablayout, null);
            _bottomView     = _outerLayout.FindViewById <BottomNavigationView>(Resource.Id.bottomtab_tabbar);
            _navigationArea = _outerLayout.FindViewById <FrameLayout>(Resource.Id.bottomtab_navarea);

            _bottomView.SetBackgroundColor(Colors.White.ToPlatform());
            _bottomView.SetOnItemSelectedListener(this);

            if (ShellItem == null)
            {
                throw new InvalidOperationException("Active Shell Item not set. Have you added any Shell Items to your Shell?");
            }

            if (ShellItem.CurrentItem == null)
            {
                throw new InvalidOperationException($"Content not found for active {ShellItem}. Title: {ShellItem.Title}. Route: {ShellItem.Route}.");
            }

            HookEvents(ShellItem);
            SetupMenu();

            _appearanceTracker       = ShellContext.CreateBottomNavViewAppearanceTracker(ShellItem);
            _bottomNavigationTracker = new BottomNavigationViewTracker();
            ((IShellController)ShellContext.Shell).AddAppearanceObserver(this, ShellItem);

            return(_outerLayout);
        }
示例#2
0
        public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            _outerLayout    = inflater.Inflate(Resource.Layout.BottomTabLayout, null);
            _bottomView     = _outerLayout.FindViewById <BottomNavigationView>(Resource.Id.bottomtab_tabbar);
            _navigationArea = _outerLayout.FindViewById <FrameLayout>(Resource.Id.bottomtab_navarea);

            _bottomView.SetBackgroundColor(Color.White.ToAndroid());
            _bottomView.SetOnNavigationItemSelectedListener(this);

            if (ShellItem == null)
            {
                throw new ArgumentException("Active Shell Item not set. Have you added any Shell Items to your Shell?", nameof(ShellItem));
            }

            HookEvents(ShellItem);
            SetupMenu();

            _appearanceTracker       = ShellContext.CreateBottomNavViewAppearanceTracker(ShellItem);
            _bottomNavigationTracker = new BottomNavigationViewTracker();
            ((IShellController)ShellContext.Shell).AddAppearanceObserver(this, ShellItem);

            return(_outerLayout);
        }
示例#3
0
        public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var context = MauiContext.Context;

            _outerLayout    = PlatformInterop.CreateNavigationBarOuterLayout(context);
            _navigationArea = PlatformInterop.CreateNavigationBarArea(context, _outerLayout);
            _bottomView     = PlatformInterop.CreateNavigationBar(context, Resource.Attribute.bottomNavigationViewStyle, _outerLayout, this);

            if (ShellItem == null)
            {
                throw new InvalidOperationException("Active Shell Item not set. Have you added any Shell Items to your Shell?");
            }

            if (ShellItem.CurrentItem == null)
            {
                throw new InvalidOperationException($"Content not found for active {ShellItem}. Title: {ShellItem.Title}. Route: {ShellItem.Route}.");
            }

            HookEvents(ShellItem);
            SetupMenu();

            _appearanceTracker       = ShellContext.CreateBottomNavViewAppearanceTracker(ShellItem);
            _bottomNavigationTracker = new BottomNavigationViewTracker();
            ((IShellController)ShellContext.Shell).AddAppearanceObserver(this, ShellItem);

            return(_outerLayout);
        }