List of usage examples for android.app ActionBar newTab
@Deprecated public abstract Tab newTab();
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);/*w w w . j a v a2s.c o m*/ 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();//from w ww .j ava 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); } }
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 w w w . jav a 2 s.c o m }
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.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 ww . j av a 2 s . co m*/ 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.cyanogenmod.settings.device.DisplaySettings.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.viewPager);// w w w.j a va 2s . c om setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setTitle(R.string.app_name); bar.setDisplayHomeAsUpEnabled(true); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.category_screen_title), ScreenFragmentActivity.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:pack_generic.Act_NPS.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager);/*www .j av a 2s . c o m*/ setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText("Frag_Page"), Frag_Page.class, null); mTabsAdapter.addTab(bar.newTab().setText("Fish list"), Act_ButtonList_Fish.ArrayListFragment.class, null); mTabsAdapter.addTab(bar.newTab().setText("Frag_List_Contacts"), Frag_List_Contacts.class, null); mTabsAdapter.addTab(bar.newTab().setText("Frag_Tabs"), Frag_Tabs.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:pack_generic.Act_NSPS.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager);//from w w w .j av a 2 s . c o m setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText("Frag_Page"), Frag_Page.class, null); mTabsAdapter.addTab(bar.newTab().setText("Frag_List_Contacts"), Frag_List_Contacts.class, null); mTabsAdapter.addTab(bar.newTab().setText("Frag_Tabs"), Frag_Tabs.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }