Ejemplo n.º 1
0
        private void InitTabBar()
        {
            if (tabBar != null)
            {
                return;
            }

            tabBar = new TabBar();
            tabBar.TabButtonSelected += tabButtonSelectedHandler;

            Add(tabBar);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a tab with tab button and content view.
        /// </summary>
        /// <param name="tabButton">A tab button to be added.</param>
        /// <param name="view">A content view to be added.</param>
        /// <since_tizen> 9 </since_tizen>
        public void AddTab(TabButton tabButton, View view)
        {
            if (TabBar != null)
            {
                TabBar.AddTabButton(tabButton);
            }

            if (Content != null)
            {
                Content.AddView(view);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new instance of TabView.
        /// </summary>
        /// <since_tizen> 9 </since_tizen>
        public TabView()
        {
            Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Vertical
            };
            WidthSpecification  = LayoutParamPolicies.MatchParent;
            HeightSpecification = LayoutParamPolicies.MatchParent;

            InitTabBar();
            InitContent();

            // To show TabBar's shadow TabBar is raised above Content.
            TabBar.RaiseAbove(Content);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Removes a tab at the specified index of TabView.
        /// The indices of tabs(tab buttons and views) in TabView are basically the order of adding to TabView by <see cref="TabView.AddTab"/>.
        /// So the index of a tab(tab button and view) in TabView can be changed whenever <see cref="TabView.AddTab"/> or <see cref="TabView.RemoveTab"/> is called.
        /// </summary>
        /// <param name="index">The index of a tab(tab button and view) in TabView where the tab will be removed.</param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the index is less than 0, or greater than or equal to the number of tabs.</exception>
        /// <since_tizen> 9 </since_tizen>
        public void RemoveTab(int index)
        {
            var tabButton = TabBar.GetTabButton(index);

            if (tabButton != null)
            {
                TabBar.RemoveTabButton(tabButton);
            }

            var view = Content.GetView(index);

            if (view != null)
            {
                Content.RemoveView(view);
            }
        }