List of usage examples for android.app ActionBar setNavigationMode
@Deprecated public abstract void setNavigationMode(@NavigationMode int mode);
From source file:com.cloudbase.cbhelperdemo.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar to show tabs. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // For each of the sections in the app, add a tab to the action bar. actionBar.addTab(actionBar.newTab().setText(R.string.title_section1).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.title_section2).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.title_section3).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.title_section4).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.title_section5).setTabListener(this)); }
From source file:com.evervolv.toolbox2.Toolbox.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager);/* ww w .j a va2s .c o m*/ setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); bar.setDisplayHomeAsUpEnabled(true); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.interface_title), Interface.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.performance_title), Performance.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.updates_title), Updates.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:edu.csh.coursebrowser.AboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); // Set up the action bar to show tabs. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // For each of the sections in the app, add a tab to the action bar. actionBar.addTab(actionBar.newTab().setText("About").setTabListener(this)); actionBar.addTab(actionBar.newTab().setText("License").setTabListener(this)); this.setTitle("About"); }
From source file:com.hybris.mobile.activity.UIComponentsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ui_components); mViewPager = (ViewPager) findViewById(R.id.pager); Fragment[] frags = { new UIComponents1Fragment(), new UIComponents2Fragment() }; FragmentPagerAdapter adapter = new TabsAdapter(getFragmentManager(), frags); mViewPager.setAdapter(adapter);/*from w w w . j a v a 2 s .c om*/ mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { getActionBar().setSelectedNavigationItem(position); } }); ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); MyTabListener tabListener = new MyTabListener(mViewPager, actionBar); Tab tab = actionBar.newTab().setText(R.string.tab_ui_components1).setTabListener(tabListener); actionBar.addTab(tab); tab = actionBar.newTab().setText(R.string.tab_ui_components2).setTabListener(tabListener); actionBar.addTab(tab); actionBar.setSelectedNavigationItem(0); }
From source file:com.balch.android.app.framework.TemplateActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); application = (BaseApplication) this.getApplicationContext(); ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); setContentView(R.layout.template_view); this.navBar = (NavBar) findViewById(R.id.nav_bar_main); this.rootLayout = (LinearLayout) findViewById(R.id.template_layout); this.frameLayout = (FrameLayout) findViewById(R.id.template_place_holder); application.configureActivity(this, this.navBar, savedInstanceState); if (savedInstanceState == null) { }/*w ww . j av a 2 s.c o m*/ getSupportFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { int backStackCount = getSupportFragmentManager().getBackStackEntryCount(); if (backStackCount > 0) { int selectedIndex = Integer.parseInt( getSupportFragmentManager().getBackStackEntryAt(backStackCount - 1).getName()); if (selectedIndex != TemplateActivity.this.navBar.getSelectedIndex()) { TemplateActivity.this.navBar.setSelectedIndex(selectedIndex); } } else { // required b/c the first stack frame has an empty fragment finish(); } } }); this.navBar.completeConfiguration(); }
From source file:com.cyanogenmod.settings.device.DeviceSettings.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.viewPager);/*ww w . ja v a 2 s .c o m*/ setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); bar.setTitle(R.string.app_name); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.category_screen_title), ScreenFragmentActivity.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.category_sensors_title), SensorsFragmentActivity.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.category_haptic_title), HapticFragmentActivity.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.category_storage_title), StorageFragmentActivity.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.category_dock_title), DockFragmentActivity.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:com.michellgaby.advsettings.DeviceSettings.java
@TargetApi(11) @Override/* www .j a va2 s . c o m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.viewPager); setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); // Remove title and icon bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowTitleEnabled(false); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.general_settings_title), GeneralSettings.class, null); /** * mTabsAdapter.addTab( * bar.newTab().setText(R.string.category_mdnie_title), * mDNIeFragmentActivity.class, null); mTabsAdapter.addTab( * bar.newTab().setText(R.string.category_sensors_title), * SensorsFragmentActivity.class, null); */ mTabsAdapter.addTab(bar.newTab().setText(R.string.system_settings_title), SystemSettings.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:fm.krui.kruifm.DJInfoActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dj_info_container_layout); showLoadingScreen(true);/*from w w w. jav a 2 s . co m*/ // Allow custom home button actions ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayHomeAsUpEnabled(true); /* For each component, create a tab for navigation */ // Stream ActionBar.Tab bioTab = actionBar.newTab().setText(getResources().getString(R.string.dj_bio_tab)) .setTabListener(this); // Extended Playlist ActionBar.Tab twitterTab = actionBar.newTab().setText(getResources().getString(R.string.dj_twitter_tab)) .setTabListener(this); // Then apply the tabs to the ActionBar. actionBar.addTab(bioTab); actionBar.addTab(twitterTab); // Download DJ object attached to the last played song to display information. Log.v(TAG, "Grabbing DJ information..."); DJInfoFetcher fetcher = new DJInfoFetcher(this, this); fetcher.execute(); }
From source file:com.android.photos.GalleryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMultiChoiceManager = new MultiChoiceManager(this); mViewPager = new ViewPager(this); mViewPager.setId(R.id.viewpager);/* www .j a v a2 s . com*/ setContentView(mViewPager); ActionBar ab = getActionBar(); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ab.setDisplayShowHomeEnabled(false); ab.setDisplayShowTitleEnabled(false); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(ab.newTab().setText(R.string.tab_photos), PhotoSetFragment.class, null); mTabsAdapter.addTab(ab.newTab().setText(R.string.tab_albums), AlbumSetFragment.class, null); if (savedInstanceState != null) { ab.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:com.example.android.contactslist.ui.ContactsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();// ww w. java 2 s .co m } super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.activity_main); final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.addTab(actionBar.newTab().setText(R.string.people).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.call_history).setTabListener(this)); // Check if two pane bool is set based on resource directories isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes); if (isTwoPaneLayout) { // If two pane layout, locate the contact detail fragment mContactDetailFragment = (ContactDetailFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_detail); } }