ActionBar setNavigationMode - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ActionBar setNavigationMode method.

This code example shows how to use the following methods:setDisplayHomeAsUpEnabled, setDisplayShowTitleEnabled, setListNavigationCallbacks, setNavigationMode, setSelectedNavigationItem
        } 
    } 
 
    private void setupActionBar(Bundle savedInstanceState) {
        bar = getActionBar();
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowTitleEnabled(false);
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
 
        adapter = new FilterAdapter(this);
        adapter.setTitle(Subreddits.getTitle(this, subreddit));
        bar.setListNavigationCallbacks(adapter, this);
        if (savedInstanceState != null) {
            bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_NAVIGATION_INDEX));
        } 
    } 
 
    public Loader<AccountResult> onCreateLoader(int id, Bundle args) {
        return new AccountLoader(this, true, false);
    } 
7
CodeRank
This code example shows how to use the following methods:setNavigationMode
 
    @Override 
    protected void setUp() { 
        if (mActionBar == null) {
            mActionBar = mActivity.getActionBar();
            mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        } 
    } 
 
    @Override 
    public void addTab(CompatTab tab) {
        String tag = tab.getTag();
 
        // Check to see if we already have a fragment for this tab, probably 
        // from a previously saved state.  If so, deactivate it, because our 
        // initial state is that a tab isn't shown. 
 
        Fragment fragment = mActivity.getSupportFragmentManager().findFragmentByTag(tag);
        tab.setFragment(fragment);
 
6
CodeRank
This code example shows how to use the following methods:addTab, newTab, setNavigationMode, setSelectedNavigationItem
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
 
		actionBar = getActionBar();
		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
		 
		Tab tab = actionBar.newTab().setText("Venda").setTabListener(new MyTabListener<SaleFragment>(this, "venda", SaleFragment.class));
		actionBar.addTab(tab);
		tab = actionBar.newTab().setText("Locação").setTabListener(new MyTabListener<RentFragment>(this, "locacao", RentFragment.class));
		actionBar.addTab(tab);
		tab = actionBar.newTab().setText("Clientes").setTabListener(new MyTabListener<ClientFragment>(this, "cliente", ClientFragment.class));
		actionBar.addTab(tab);
		 
		if(savedInstanceState != null) {
			actionBar.setSelectedNavigationItem(savedInstanceState.getInt("selected"));
		} 
	} 
 
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) {
6
CodeRank
This code example shows how to use the following methods:addTab, newTab, setDisplayShowTitleEnabled, setNavigationMode
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        actionBar = getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.setDisplayShowTitleEnabled(false);
 
        ActionBar.Tab tab = actionBar.newTab()
                .setText("Images")
                .setTabListener(new TabListener<ImagesFragment>(this, "Images", ImagesFragment.class));
        actionBar.addTab(tab);
 
        tab = actionBar.newTab()
                .setText("Settings")
                .setTabListener(new TabListener<SettingsFragment>(this, "Settings", SettingsFragment.class));
        actionBar.addTab(tab);
 
    } 
 

6
CodeRank
This code example shows how to use the following methods:addTab, newTab, setDisplayShowTitleEnabled, setNavigationMode, setSelectedNavigationItem
 
    private ActionBar actionBar;
 
    private void init_action_bar() { 
        actionBar = getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle("I am new here...");
        actionBar.addTab(actionBar.newTab()
                .setText("Lectures")
                .setTabListener(new TabListener<LectureFragment>(
                        this, "lectures", LectureFragment.class)));
        actionBar.addTab(actionBar.newTab()
                .setText("Map")
                .setTabListener(new TabListener<MapFragment>(
                        this, "map", MapFragment.class)));
        actionBar.addTab(actionBar.newTab()
                .setText("Todo")
                .setTabListener(new TabListener<TodoFragment>(
                        this, "todo", TodoFragment.class)));

6
CodeRank
This code example shows how to use the following methods:addTab, newTab, setDisplayShowHomeEnabled, setDisplayShowTitleEnabled, setNavigationMode
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        final ActionBar bar = getActionBar();
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        bar.setDisplayShowHomeEnabled(false);
        bar.setDisplayShowTitleEnabled(false);
 
        bar.addTab(bar
                .newTab()
                .setText("Podcasts")
                .setTabListener(
                        new TabListener<PodcastsFragment>(this, "podcasts", PodcastsFragment.class)));
 
        bar.addTab(bar
                .newTab()
                .setText("Favorite")
                .setTabListener(
                        new TabListener<FavorFragment>(this, "favorite",

6
CodeRank
This code example shows how to use the following methods:newTab, setDisplayShowHomeEnabled, setDisplayShowTitleEnabled, setNavigationMode, setSelectedNavigationItem
        mViewPager.setId(1234);
        setContentView(mViewPager);
 
        // setup action bar for tabs 
        ActionBar actionBar = getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowHomeEnabled(false);
 
        mTabsAdapter = new TabsAdapter(this, mViewPager);
        mTabsAdapter.addTab(actionBar.newTab().setText("home"), HomeFragment.class, null);
        mTabsAdapter.addTab(actionBar.newTab().setText("friends"), FriendsListFragment.class, null);
        mTabsAdapter.addTab(actionBar.newTab().setText("about"), AboutFragment.class, null);
 
        // check for last open tab 
        if (savedInstanceState != null) {
            actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
        } 
    } 
 

6
CodeRank
This code example shows how to use the following methods:addTab, newTab, setDisplayShowHomeEnabled, setDisplayShowTitleEnabled, setNavigationMode
        } 
    } 
     
    public void loadActionBar(){ 
  	  ActionBar actionBar = getActionBar();
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
         
        Tab tab = actionBar
                .newTab()
                .setText("Schedule")
                .setTabListener(new DialogNavTabListener<ScheduleFragment>(this, "schedule", ScheduleFragment.class));
        actionBar.addTab(tab);
         
        tab = actionBar
                .newTab()
                .setText("Courses")
                .setTabListener(new NavTabListener<CourseFragment>(this, "courses", CourseFragment.class));
        actionBar.addTab(tab);

6
CodeRank
This code example shows how to use the following methods:addTab, newTab, setNavigationMode, setTitle
		workwithTabbedActionBar(); 
	} 
 
	public void workwithTabbedActionBar() { 
		ActionBar bar = this.getActionBar();
		bar.setTitle(tag);
		bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
 
		TabListener tl = new TabListener(this, this);
 
		Tab tab1 = bar.newTab();
		tab1.setText("Tab1");
		tab1.setTabListener(tl);
		bar.addTab(tab1);
 
		Tab tab2 = bar.newTab();
		tab2.setText("Tab2");
		tab2.setTabListener(tl);
		bar.addTab(tab2);
	} 

6
CodeRank
This code example shows how to use the following methods:addTab, newTab, setNavigationMode, setTitle
		workwithStandardActionBar(); 
	} 
 
	public void workwithStandardActionBar() { 
		ActionBar bar = this.getActionBar();
		bar.setTitle(tag);
		bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
		// test to see what happens if you were to attach tabs 
		attachTabs(bar);
	} 
 
	public void attachTabs(ActionBar bar) {
		TabListener tl = new TabListener(this, this);
 
		Tab tab1 = bar.newTab();
		tab1.setText("Tab1");
		tab1.setTabListener(tl);
		bar.addTab(tab1);
 
		Tab tab2 = bar.newTab();

6
CodeRank
setNavigationMode Method Overview
Set the current navigation mode.
See Code Examples for other Android ActionBar Methods: