public void OnTabSelected(ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
 {
   switch (tab.Text)
   {
     case "ListView":
       ft.Replace(Android.Resource.Id.Content, new ListViewFragment());
       break;
     case "RecyclerView":
       ft.Replace(Android.Resource.Id.Content, new RecyclerViewFragment());
       break;
     case "ScrollView":
       ft.Replace(Android.Resource.Id.Content, new ScrollViewFragment());
       break;
   }
 }
        public void OnTabSelected(ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
        {
            if (fragment == null)
            {
                fragment = new SampleTabFragment();
                var id = (int)Build.VERSION.SdkInt >= 14 ?
                Android.Resource.Id.Content :
                Resource.Id.action_bar_activity_content;

                ft.Add(id, fragment, "tag");
            }
            else
            {
                ft.Attach(fragment);
            }
            
        }
Example #3
0
        protected void InitializeActionBar(Android.Support.V7.App.ActionBar ab)
        {
            mActionBar = ab;

            LayoutInflater mInflater = LayoutInflater.From (this);
            View mCustomView = mInflater.Inflate (Resource.Layout.ActionBar, null);

            ActionBarTitle = mCustomView.FindViewById<TextView> (Resource.Id.title);
            ActionBarBack = mCustomView.FindViewById<ImageButton> (Resource.Id.backButton);
            ActionBarAdd = mCustomView.FindViewById<ImageButton> (Resource.Id.addButton);
            ActionBarSearch = mCustomView.FindViewById<ImageButton> (Resource.Id.searchButton);
            ActionBarClose = mCustomView.FindViewById<ImageButton> (Resource.Id.closeButton);
            ActionBarDelete = mCustomView.FindViewById<ImageButton> (Resource.Id.deleteButton);
            ActionBarQuery = mCustomView.FindViewById<EditText>(Resource.Id.query);

            ActionBarBack.Click += (sender, e) => OnBackPressed ();

            var layout = new Android.Support.V7.App.ActionBar.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            mActionBar.SetCustomView (mCustomView, layout);
            mActionBar.SetDisplayShowCustomEnabled (true);
        }
 public void OnTabUnselected(ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
 {
     if (fragment != null)
         ft.Detach(fragment);
 }
 public void OnTabReselected(ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
 {
     
 }
		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);
			SetContentView(Resource.Layout.main_activity);
			SetFullscreen();

			view = FindViewById(Resource.Id.main_parent_view);

			// 액션바
			toolbar = FindViewById<Toolbar>(Resource.Id.main_toolbar);
			SetSupportActionBar(toolbar);
			actionBar = SupportActionBar;
			actionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu_white);
			actionBar.SetDisplayHomeAsUpEnabled(true);
			actionBar.Title = Resources.GetString(Resource.String.ApplicationName);
			actionBar.Show();

			TabLayoutViewPager();
			NaviView();

			//var position = tabLayout.SelectedTabPosition;
			//viewPager.SetCurrentItem(0, true);
			actionBar.SetBackgroundDrawable(new ColorDrawable(Resources.GetColor(Resource.Color.tab1_actionbar_background)));
			tabLayout.Background = new ColorDrawable(Resources.GetColor(Resource.Color.tab1_tablayout_background));
			tabLayout.SetSelectedTabIndicatorColor(Resources.GetColor(Resource.Color.tab1_tabindicator_background));
		}
			public TabLayoutOnTabSelectedListener(Context context, ViewPager viewPager, ActionBar actionBar, TabLayout tabLayout)
			{
				this.context = context;
				this.viewPager = viewPager;
				this.actionBar = actionBar;
				this.tabLayout = tabLayout;
			}
 public void OnTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction)
 {
 }
        public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction)
        {
            // When the given tab is selected, switch to the corresponding page in
            // the ViewPager.
            int pos = tab.Position;
            mViewPager.CurrentItem = pos;

            Fragment fragment = ((FragmentPagerAdapter) mViewPager.Adapter).GetItem(pos);
            if (fragment is FragmentListener)
            {
                ((FragmentListener) fragment).OnFragmentSelected();
            }
        }