Java Code Examples for android.support.v7.app.ActionBar#setNavigationMode()
The following examples show how to use
android.support.v7.app.ActionBar#setNavigationMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From easy-adapter with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(new MyPageAdapter(getSupportFragmentManager())); mViewPager.setOnPageChangeListener(mPageChangeListener); final ActionBar actionBar = getSupportActionBar(); if (actionBar!= null) { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.addTab(actionBar .newTab() .setText(getString(R.string.tab_1_name)) .setTabListener(mTabListener)); actionBar.addTab(actionBar .newTab() .setText(getString(R.string.tab_2_name)) .setTabListener(mTabListener)); } }
Example 2
Source File: MainActivity.java From sms-ticket with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setup actionbar tabs ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.addTab(bar.newTab().setText(getString(R.string.tab_tickets)).setTabListener(mTabListener)); bar.addTab(bar.newTab().setText(getString(R.string.tab_statistics)).setTabListener(mTabListener)); if (savedInstanceState != null) { mSelectedTab = savedInstanceState.getInt("selectedTab", TAB_TICKETS); } bar.setSelectedNavigationItem(mSelectedTab); handleIntent(getIntent()); UpdateService.call(this, false); checkForHigherPriorityReceivers(); checkForSim(); checkForEula(); }
Example 3
Source File: NavigationDrawerFragment.java From RedEnvelopeAssistant with MIT License | 5 votes |
/** * Per the navigation drawer design guidelines, updates the action bar to * show the global app 'context', rather than just what's in the current * screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); }
Example 4
Source File: AboutActivity.java From upcKeygen with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about_main); // Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar.addTab( actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) .setTabListener(this)); } }
Example 5
Source File: MainActivity.java From QuickReturn with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(""); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); String[] actionBarItems = { "ListView", "GridView", "ScrollView" }; SpinnerAdapter spinnerAdapter = new ArrayAdapter<>(this, R.layout.action_bar_spinner_text, actionBarItems); actionBar.setListNavigationCallbacks(spinnerAdapter, this); initialize(R.layout.activity_main); }
Example 6
Source File: NavigationDrawerFragment.java From TitanjumNote with Apache License 2.0 | 5 votes |
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); }
Example 7
Source File: NavigationDrawerFragment.java From BlurNavigationDrawer with Apache License 2.0 | 5 votes |
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); }
Example 8
Source File: MarkdownDemo.java From support with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_markdown_demo); // Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { actionBar.addTab( actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) .setTabListener(this)); } }
Example 9
Source File: NavigationDrawerFragment.java From droidddle with Apache License 2.0 | 5 votes |
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); }
Example 10
Source File: FolderPickerActivity.java From Cirrus_depricated with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); super.onCreate(savedInstanceState); setContentView(R.layout.files_folder_picker); if (savedInstanceState == null) { createFragments(); } fpToolbar = (Toolbar) findViewById(R.id.toolbar); if (fpToolbar != null) { setSupportActionBar(fpToolbar); } // sets callback listeners for UI elements initControls(); // Action bar setup ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mProgressBar.setIndeterminateDrawable( getResources().getDrawable( R.drawable.actionbar_progress_indeterminate_horizontal)); mProgressBar.setIndeterminate(mSyncInProgress); // always AFTER setContentView(...) ; to work around bug in its implementation // sets message for empty list of folders setBackgroundText(); Log_OC.d(TAG, "onCreate() end"); }
Example 11
Source File: NavigationDrawerFragment.java From giraff-android with GNU Affero General Public License v3.0 | 5 votes |
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); // actionBar.setTitle(R.string.app_name); }
Example 12
Source File: PullMenuActivity.java From AndroidPullMenu with Apache License 2.0 | 4 votes |
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); }
Example 13
Source File: BlurNavigationDrawerActivity.java From UltimateAndroid with Apache License 2.0 | 4 votes |
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); }
Example 14
Source File: MainActivity.java From android-sensor-example with Apache License 2.0 | 4 votes |
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); // actionBar.setTitle(mTitle); }
Example 15
Source File: DropdownProxy.java From actionbarextras with MIT License | 4 votes |
private void handleAdd(boolean keepTitle){ ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(keepTitle); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); }
Example 16
Source File: MainActivity.java From android-IconicFontEngine with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // createFontAwesomeEngine(); IconicFontEngine.addDefaultEngine( new FontAwesomeEngine(Typeface.createFromAsset(getAssets(), "fonts/fontawesome-webfont.ttf"))); IconicFontEngine.addDefaultEngine( new TypiconsEngine(Typeface.createFromAsset(getAssets(), "fonts/typicons.ttf"))); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar.addTab( actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) .setTabListener(this)); } }
Example 17
Source File: MainActivity.java From android-open-project-demo with Apache License 2.0 | 4 votes |
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); }
Example 18
Source File: MainActivity.java From jus with Apache License 2.0 | 4 votes |
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); }
Example 19
Source File: HomeActivity.java From droid-stealth with GNU General Public License v2.0 | 4 votes |
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); }
Example 20
Source File: ChartActivity.java From EazeGraph with Apache License 2.0 | 4 votes |
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); }