Esempio n. 1
0
        private void SetTabSections(int index)
        {
            ResetView();
            var trasaction = fragmentManager.BeginTransaction();

            //隐藏掉所有的fragment
            HideFragments(trasaction);
            switch (index)
            {
            case 0:
                ll_tab_bottom_server.SetBackgroundResource(Resource.Color.griditems_bg);
                btn_tab_bottom_server.SetImageResource(Resource.Drawable.ic_menu_health_selected);
                tv_tab_bottom_server.SetTextColor(Resources.GetColor(Resource.Color.blue));
                if (_serverFrag == null)
                {
                    _serverFrag = new MainTabServerFragment();
                    trasaction.Add(Resource.Id.id_mainContent, _serverFrag);
                }
                else
                {
                    trasaction.Show(_serverFrag);
                }
                break;

            case 1:
                ll_tab_bottom_finance.SetBackgroundResource(Resource.Color.griditems_bg);
                btn_tab_bottom_finance.SetImageResource(Resource.Drawable.ic_menu_alarm_selected);
                tv_tab_bottom_finance.SetTextColor(Resources.GetColor(Resource.Color.blue));
                if (_financeFrag == null)
                {
                    _financeFrag = new MainTabFinanceFragment();
                    trasaction.Add(Resource.Id.id_mainContent, _financeFrag);
                }
                else
                {
                    trasaction.Show(_financeFrag);
                }
                break;

            case 2:
                ll_tab_bottom_my.SetBackgroundResource(Resource.Color.griditems_bg);
                btn_tab_bottom_my.SetImageResource(Resource.Drawable.ic_menu_mine_selected);
                tv_tab_bottom_my.SetTextColor(Resources.GetColor(Resource.Color.blue));
                if (_myFrag == null)
                {
                    _myFrag = new MainTabMyFragment();
                    trasaction.Add(Resource.Id.id_mainContent, _myFrag);
                }
                else
                {
                    trasaction.Show(_myFrag);
                }
                break;
            }
            trasaction.Commit();
        }
Esempio n. 2
0
		private void SetTabSections(int index)
		{
			ResetView ();
			var trasaction = fragmentManager.BeginTransaction ();

			//隐藏掉所有的fragment
			HideFragments(trasaction);
			switch (index) {
			case 0:
				ll_tab_bottom_server.SetBackgroundResource (Resource.Color.griditems_bg);
				btn_tab_bottom_server.SetImageResource (Resource.Drawable.ic_menu_health_selected);
				tv_tab_bottom_server.SetTextColor(Resources.GetColor(Resource.Color.blue));
				if (_serverFrag == null) {
					_serverFrag = new MainTabServerFragment ();
					trasaction.Add (Resource.Id.id_mainContent, _serverFrag);
				}
				else
					trasaction.Show(_serverFrag);
				break;
			case 1:
				ll_tab_bottom_finance.SetBackgroundResource (Resource.Color.griditems_bg);
				btn_tab_bottom_finance.SetImageResource (Resource.Drawable.ic_menu_alarm_selected);
				tv_tab_bottom_finance.SetTextColor(Resources.GetColor(Resource.Color.blue));
				if (_financeFrag == null) {
					_financeFrag = new MainTabFinanceFragment ();
					trasaction.Add (Resource.Id.id_mainContent, _financeFrag);

				} else
					trasaction.Show (_financeFrag);
				break;		
			case 2:
				ll_tab_bottom_my.SetBackgroundResource (Resource.Color.griditems_bg);
				btn_tab_bottom_my.SetImageResource (Resource.Drawable.ic_menu_mine_selected);
				tv_tab_bottom_my.SetTextColor(Resources.GetColor(Resource.Color.blue));
				if (_myFrag == null) {
					_myFrag = new MainTabMyFragment ();
					trasaction.Add (Resource.Id.id_mainContent, _myFrag);

				} else
					trasaction.Show (_myFrag);
				break;	
			}
			trasaction.Commit ();
		}