Created
May 9, 2017 21:31
-
-
Save dsibinski/621414dcb86e331e87b0ffd12939df1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AddTab(string tabText, Fragment view) | |
{ | |
var tab = this.ActionBar.NewTab(); | |
tab.SetText(tabText); | |
tab.TabSelected += delegate (object sender, ActionBar.TabEventArgs e) | |
{ | |
var fragment = this.FragmentManager.FindFragmentById(Resource.Id.tabFragmentsContainer); | |
if (fragment != null) | |
e.FragmentTransaction.Remove(fragment); | |
e.FragmentTransaction.Add(Resource.Id.tabFragmentsContainer, view); | |
}; | |
tab.TabUnselected += delegate (object sender, ActionBar.TabEventArgs e) { | |
e.FragmentTransaction.Remove(view); | |
}; | |
this.ActionBar.AddTab(tab); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment