List of usage examples for android.app ActionBar addTab
@Deprecated public abstract void addTab(Tab tab);
From source file:com.commonsware.android.feedfrags.FeedsTabActivity.java
public void addNewFeed(final Feed feed) { ActionBar bar = getActionBar(); bar.addTab(bar.newTab().setText(feed.toString()).setTabListener(new TabListener(feed))); }
From source file:com.example.android.pm.shortcutlauncherdemo.ShortcutLauncherMain.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);//from ww w. ja v a2 s .c om mPager = (ViewPager) findViewById(R.id.pager); mPager.setOffscreenPageLimit(2); mPagerAdapter = new MyPagerAdapter(getFragmentManager()); mPager.setAdapter(mPagerAdapter); final ActionBar ab = getActionBar(); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ab.addTab(ab.newTab().setText("App list").setTabListener(mTabListener)); ab.addTab(ab.newTab().setText("Pinned shortcuts").setTabListener(mTabListener)); }
From source file:com.example.android.contactslist.ui.ContactsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();//w w w .j a v a 2s . 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); } }
From source file:com.normalexception.neobd.NeobdActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_neobd); appContext = this; // Set up the action bar. 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_section_welcome) .setTabListener(new TabListener(new WelcomeTab()))); actionBar.addTab(actionBar.newTab().setText(R.string.title_section_obd2) .setTabListener(new TabListener(new OBDTab()))); actionBar.addTab(actionBar.newTab().setText(R.string.title_section_dtc) .setTabListener(new TabListener(new DTCTab()))); // Initialize the database neod = NEODatabase.getInstance();//from www .j av a 2 s . c om }
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: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:edu.csh.coursebrowser.SectionInfoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_section_info); Bundle args = this.getIntent().getExtras(); this.args = args.getString("args"); this.setTitle(args.getString("title")); Log.v("Sections", args.getString("args")); // 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("All").setTabListener(this)); actionBar.addTab(actionBar.newTab().setText("Non-Full").setTabListener(this)); actionBar.addTab(actionBar.newTab().setText("Full").setTabListener(this)); }
From source file:in.ac.iitb.intulearn.DetailsActivity.java
/** * Initialise the fragments to be paged//from w w w . ja v a 2 s .c o m */ private void initialisePaging() { // Set up the action bar. ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); // REF: http://android-er.blogspot.in/2012/06/create-actionbar-in-tab-navigation-mode.html actionBar.addTab(actionBar.newTab().setText(R.string.title_fragment_description) .setTabListener(new CustomTabListener(this, DescriptionFragment.class.getName()))); actionBar.addTab(actionBar.newTab().setText(R.string.title_fragment_experiment) .setTabListener(new CustomTabListener(this, ExperimentFragment.class.getName()))); actionBar.addTab(actionBar.newTab().setText(R.string.title_fragment_evaluate) .setTabListener(new CustomTabListener(this, EvaluateFragment.class.getName()))); }
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);//ww w . j av 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.example.routerecorder.FragmentTabs.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); instance = this; final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); //bar.setDisplayShowCustomEnabled(true); //bar.setDisplayShowTitleEnabled(false); //bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowCustomEnabled(false); bar.addTab(bar.newTab().setText("Show Map") .setTabListener(new TabListener<RouteMapFragment>(this, "Show Map", RouteMapFragment.class))); bar.addTab(bar.newTab().setText("Add Trip") .setTabListener(new TabListener<AddRouteFragment>(this, "Add Trip", AddRouteFragment.class))); bar.addTab(bar.newTab().setText("Show List") .setTabListener(new TabListener<MyListFragment>(this, "Show List", MyListFragment.class))); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); }/*from ww w. jav a 2 s . c o m*/ //FragmentManager manager = getSupportFragmentManager(); //fragmentA = (RouteMapFragment) manager.findFragmentById(R.id.map); //fragmentB = (AddRouteFragment) manager.findFragmentById(R.id.fragment_container); }