Created
July 24, 2013 17:23
-
-
Save topgenorth/6072607 to your computer and use it in GitHub Desktop.
Sample ActionBar code
This file contains hidden or 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
private void InitializeActionBar() | |
{ | |
ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; | |
var firstTab = SetupGraffitiGridTab(); | |
SetupGraffitiMapTab(); | |
ActionBar.SelectTab(firstTab); | |
} | |
private ActionBar.Tab SetupGraffitiGridTab() | |
{ | |
_graffittiGridTab = ActionBar.NewTab(); | |
_graffittiGridTab.SetText(Resources.GetString(Resource.String.tab_text_list)); | |
_graffittiGridTab.SetIcon(Resource.Drawable.ic_action_graffiti_list); | |
_graffittiGridTab.TabSelected += (sender, args) => { DisplayGraffitiGrid(); }; | |
ActionBar.AddTab(_graffittiGridTab); | |
return _graffittiGridTab; | |
} | |
private void SetupGraffitiMapTab() | |
{ | |
_mapTab = ActionBar.NewTab(); | |
_mapTab.SetText(Resources.GetString(Resource.String.tab_text_maptab)); | |
_mapTab.SetIcon(Resource.Drawable.ic_action_graffiti_map); | |
_mapTab.TabSelected += (sender, args) => { _viewModel.DisplayAllInMap(this, _locationHelper.LastLocation); }; | |
ActionBar.AddTab(_mapTab); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also need to have this line in OnCreate:
RequestWindowFeature(WindowFeatures.ActionBar);