コード例 #1
0
        void ResetToolbar()
        {
            AToolbar oldToolbar = _toolbar;

            _toolbar.SetNavigationOnClickListener(null);
            _toolbar.RemoveFromParent();

            _toolbar.RemoveView(_titleView);
            _titleView = null;

            if (_titleViewRenderer != null)
            {
                Platform.ClearRenderer(_titleViewRenderer.View);
                _titleViewRenderer.Dispose();
                _titleViewRenderer = null;
            }

            _toolbar.RemoveView(_titleIconView);
            _titleIconView = null;

            _imageSource = null;

            _toolbar = null;

            SetupToolbar();

            // if the old toolbar had padding from transluscentflags, set it to the new toolbar
            if (oldToolbar.PaddingTop != 0)
            {
                _toolbar.SetPadding(0, oldToolbar.PaddingTop, 0, 0);
            }

            RegisterToolbar();
            UpdateToolbar();
            UpdateMenu();

            // Preserve old values that can't be replicated by calling methods above
            if (_toolbar != null)
            {
                _toolbar.Subtitle = oldToolbar.Subtitle;
            }
        }