Best code examples for Android ActionBar class (android.app.ActionBar)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ActionBar class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android ActionBar examples from Open Source projects
This code example shows how to use the following methods: setBackgroundDrawable, setCustomView, setDisplayShowCustomEnabled, setDisplayShowTitleEnabled
320:	actionBar.setCustomView(mActionBarLayout); 
321:	actionBar.setDisplayShowCustomEnabled(true); 
322:	actionBar.setDisplayShowTitleEnabled(false); 
-
325:	actionBar.setBackgroundDrawable(getDrawable("action_bar")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDisplayHomeAsUpEnabled, setDisplayOptions, setIcon
28:	bar.setIcon(getIcon()); 
29:	bar.setDisplayOptions(0, ActionBar.DISPLAY_HOME_AS_UP); 
30:	bar.setDisplayHomeAsUpEnabled(true); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDisplayHomeAsUpEnabled, setDisplayShowTitleEnabled, setListNavigationCallbacks, setNavigationMode, setSelectedNavigationItem
103:	bar.setDisplayHomeAsUpEnabled(true); 
104:	bar.setDisplayShowTitleEnabled(false); 
105:	bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); 
-
109:	bar.setListNavigationCallbacks(adapter, this); 
-
111:	bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_NAVIGATION_INDEX)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getNavigationMode, getSelectedNavigationIndex, setSelectedNavigationItem
316:	final int actionBarSelectedNavIndex = mActionBar.getSelectedNavigationIndex(); 
317:	switch(mActionBar.getNavigationMode()) { 
-
320:	mActionBar.setSelectedNavigationItem(mCurrentTab); 
-
326:	mActionBar.setSelectedNavigationItem( 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setDisplayHomeAsUpEnabled, setDisplayShowTitleEnabled
28:	actionBar.setDisplayShowTitleEnabled(true); 
29:	actionBar.setDisplayHomeAsUpEnabled(true); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setHomeButtonEnabled
80:	action_bar.setHomeButtonEnabled(enabled); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelectedNavigationItem
133:	mActionBar.setSelectedNavigationItem(position); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setDisplayShowTitleEnabled, setNavigationMode, setSelectedNavigationItem
31:	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
32:	actionBar.setDisplayShowTitleEnabled(true); 
33:	actionBar.setTitle("I am new here..."); 
34:	actionBar.addTab(actionBar.newTab() 
-
38:	actionBar.addTab(actionBar.newTab() 
-
42:	actionBar.addTab(actionBar.newTab() 
-
74:	actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelectedNavigationItem
135:	mActionBar.setSelectedNavigationItem(position); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setNavigationMode
19:	b.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
20:	Tab tab = b.newTab().setText("Library").setTabListener(new TabListener<LibraryActivity>(this, "library", LibraryActivity.class)); 
21:	b.addTab(tab, 0, true); 
-
23:	tab = b.newTab().setText("Queue").setTabListener(new TabListener<QueueActivity>(this, "queue", QueueActivity.class)); 
24:	b.addTab(tab, 1, false); 
-
26:	tab = b.newTab().setText("Now Playing").setTabListener(new TabListener<NowPlayingActivity>(this, "nowplaying", NowPlayingActivity.class)); 
27:	b.addTab(tab, 2, false); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setDisplayShowHomeEnabled, setDisplayShowTitleEnabled, setNavigationMode
25:	bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
26:	bar.setDisplayShowHomeEnabled(false); 
27:	bar.setDisplayShowTitleEnabled(false); 
-
29:	bar.addTab(bar 
30:	.newTab() 
-
35:	bar.addTab(bar 
36:	.newTab() 
-
43:	bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newTab, setDisplayShowHomeEnabled, setDisplayShowTitleEnabled, setNavigationMode, setSelectedNavigationItem
27:	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
28:	actionBar.setDisplayShowTitleEnabled(false); 
29:	actionBar.setDisplayShowHomeEnabled(false); 
-
32:	mTabsAdapter.addTab(actionBar.newTab().setText("home"), HomeFragment.class, null); 
33:	mTabsAdapter.addTab(actionBar.newTab().setText("friends"), FriendsListFragment.class, null); 
34:	mTabsAdapter.addTab(actionBar.newTab().setText("about"), AboutFragment.class, null); 
-
38:	actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, getTabCount, newTab, setDisplayOptions, setDisplayShowTitleEnabled
45:	actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE); 
46:	actionBar.setDisplayShowTitleEnabled(false); 
47:	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
-
49:	if(actionBar.getTabCount() == 0){ 
-
51:	noCompletedTab = actionBar.newTab() 
-
54:	completedTab = actionBar.newTab() 
-
58:	actionBar.addTab(noCompletedTab); 
59:	actionBar.addTab(completedTab); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelectedNavigationItem
191:	mActionBar.setSelectedNavigationItem(position); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDisplayHomeAsUpEnabled
47:	actionBar.setDisplayHomeAsUpEnabled(true); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setDisplayShowHomeEnabled, setDisplayShowTitleEnabled, setNavigationMode
37:	actionBar.setDisplayShowHomeEnabled(false); 
-
39:	actionBar.setDisplayShowTitleEnabled(false); 
-
41:	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
-
45:	Tab1 = actionBar.newTab().setText("Info"); 
46:	Tab2 = actionBar.newTab().setText("Obsah"); 
47:	Tab3 = actionBar.newTab().setText("Text"); 
-
55:	actionBar.addTab(Tab1); 
56:	actionBar.addTab(Tab2); 
57:	actionBar.addTab(Tab3); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setDisplayShowHomeEnabled, setDisplayShowTitleEnabled, setNavigationMode
90:	actionBar.setDisplayShowTitleEnabled(false); 
91:	actionBar.setDisplayShowHomeEnabled(true); 
92:	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
-
95:	.newTab() 
-
98:	actionBar.addTab(tab); 
-
101:	.newTab() 
-
104:	actionBar.addTab(tab); 
-
107:	.newTab() 
-
110:	actionBar.addTab(tab); 
-
113:	.newTab() 
-
116:	actionBar.addTab(tab); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setNavigationMode
41:	mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setNavigationMode, setTitle
22:	bar.setTitle(tag); 
23:	bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
-
27:	Tab tab1 = bar.newTab(); 
-
30:	bar.addTab(tab1); 
-
32:	Tab tab2 = bar.newTab(); 
-
35:	bar.addTab(tab2); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setNavigationMode, setTitle
22:	bar.setTitle(tag); 
23:	bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); 
-
31:	Tab tab1 = bar.newTab(); 
-
34:	bar.addTab(tab1); 
-
36:	Tab tab2 = bar.newTab(); 
-
39:	bar.addTab(tab2); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setListNavigationCallbacks
24:	getActionBar().setListNavigationCallbacks(new ArrayAdapter<String>(this, 0), null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDisplayHomeAsUpEnabled, setDisplayOptions, setIcon
28:	bar.setIcon(getIcon()); 
29:	bar.setDisplayOptions(0, ActionBar.DISPLAY_HOME_AS_UP); 
30:	bar.setDisplayHomeAsUpEnabled(true); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setNavigationMode, setTitle
26:	bar.setTitle(tag); 
27:	bar.setNavigationMode( 
-
32:	Tab tab1 = bar.newTab(); 
-
35:	bar.addTab(tab1); 
-
37:	Tab tab2 = bar.newTab(); 
-
40:	bar.addTab(tab2); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelectedNavigationItem
129:	mActionBar.setSelectedNavigationItem(position); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDisplayHomeAsUpEnabled, setHomeButtonEnabled
47:	actionBar.setDisplayHomeAsUpEnabled(true); 
48:	actionBar.setHomeButtonEnabled(true); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isShowing
59:	return actionBar.isShowing(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getDisplayOptions, getNavigationMode, setNavigationMode, setSelectedNavigationItem, setTitle
390:	final int current = mActionBar.getDisplayOptions() & MASK; 
-
432:	final int currentNavigationMode = mActionBar.getNavigationMode(); 
-
444:	mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
445:	mActionBar.setSelectedNavigationItem(mCurrentTab); 
-
450:	mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); 
451:	mActionBar.setSelectedNavigationItem( 
-
455:	mActionBar.setTitle(null); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSelectedNavigationItem
133:	mActionBar.setSelectedNavigationItem(position); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addTab, newTab, setNavigationMode, setSelectedNavigationItem
21:	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
-
23:	Tab tab = actionBar.newTab().setText("Venda").setTabListener(new MyTabListener<SaleFragment>(this, "venda", SaleFragment.class)); 
24:	actionBar.addTab(tab); 
25:	tab = actionBar.newTab().setText("Locação").setTabListener(new MyTabListener<RentFragment>(this, "locacao", RentFragment.class)); 
26:	actionBar.addTab(tab); 
27:	tab = actionBar.newTab().setText("Clientes").setTabListener(new MyTabListener<ClientFragment>(this, "cliente", ClientFragment.class)); 
28:	actionBar.addTab(tab); 
-
31:	actionBar.setSelectedNavigationItem(savedInstanceState.getInt("selected")); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDisplayHomeAsUpEnabled
99:	actionBar.setDisplayHomeAsUpEnabled(showHomeAsUp); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setDisplayHomeAsUpEnabled
236:	actionBar.setDisplayHomeAsUpEnabled(true); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: addTab, newTab, setDisplayShowTitleEnabled, setNavigationMode
23:	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
24:	actionBar.setDisplayShowTitleEnabled(false); 
-
26:	ActionBar.Tab tab = actionBar.newTab() 
-
29:	actionBar.addTab(tab); 
-
31:	tab = actionBar.newTab() 
-
34:	actionBar.addTab(tab); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDisplayOptions
163:	actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setListNavigationCallbacks, setNavigationMode, setTitle
21:	bar.setTitle(tag); 
22:	bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); 
23:	bar.setListNavigationCallbacks(new SimpleSpinnerArrayAdapter(this), 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getCustomView, setDisplayHomeAsUpEnabled
36:	mActionBar.getCustomView().setVisibility(View.GONE); 
-
39:	mActionBar.setDisplayHomeAsUpEnabled(true); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setListNavigationCallbacks, setNavigationMode, setTitle
25:	bar.setTitle(tag); 
26:	bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); 
27:	bar.setListNavigationCallbacks( 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setDisplayShowTitleEnabled, setNavigationMode, setTitle
166:	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); 
167:	actionBar.setDisplayShowTitleEnabled(true); 
168:	actionBar.setTitle(mTitle); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSubtitle, setTitle
168:	mBar.setTitle(main); 
-
170:	mBar.setSubtitle(null); 
-
172:	mBar.setSubtitle(extra); 
Full Snippet Info
5
CodeRank
Related Android ActionBar Questions & Answers:
Other Android ActionBar Examples
0:	ActionBar actionBar = getActionBar();
1:	
2:	// set the icon

Read More

0:	ActionBar actionBar = getActionBar();
1:	// hide the action bar
2:	actionBar.hide();

Read More

12:	
13:			// get action bar	
14:			ActionBar actionBar = getActionBar();
15:	
16:			// Enabling Up / Back navigation

Read More

See Code Examples for Android ActionBar Methods: