android.support.v7.app.ActionBar#setNavigationMode ( )源码实例Demo

下面列出了android.support.v7.app.ActionBar#setNavigationMode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: sms-ticket   文件: MainActivity.java
@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();
}
 
源代码2 项目: easy-adapter   文件: MainActivity.java
@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));
    }
}
 
源代码3 项目: upcKeygen   文件: AboutActivity.java
@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));
    }
}
 
源代码4 项目: giraff-android   文件: NavigationDrawerFragment.java
/**
     * 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);
    }
 
源代码5 项目: Cirrus_depricated   文件: FolderPickerActivity.java
@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");
}
 
源代码6 项目: droidddle   文件: NavigationDrawerFragment.java
/**
 * 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);
}
 
源代码7 项目: support   文件: MarkdownDemo.java
@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));
    }
}
 
/**
 * 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);
}
 
源代码9 项目: TitanjumNote   文件: NavigationDrawerFragment.java
/**
 * 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);
}
 
源代码10 项目: QuickReturn   文件: MainActivity.java
@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);
}
 
/**
 * 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);
}
 
源代码12 项目: EazeGraph   文件: ChartActivity.java
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
源代码13 项目: jus   文件: MainActivity.java
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
源代码14 项目: android-sensor-example   文件: MainActivity.java
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    //  actionBar.setTitle(mTitle);
}
 
源代码15 项目: AndroidPullMenu   文件: PullMenuActivity.java
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
源代码17 项目: actionbarextras   文件: DropdownProxy.java
private void handleAdd(boolean keepTitle){
	ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar();
	actionBar.setDisplayShowTitleEnabled(keepTitle);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
}
 
源代码18 项目: android-IconicFontEngine   文件: MainActivity.java
@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));
    }
}
 
源代码19 项目: android-open-project-demo   文件: MainActivity.java
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
源代码20 项目: droid-stealth   文件: HomeActivity.java
public void restoreActionBar() {
	ActionBar actionBar = getSupportActionBar();
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(mTitle);
}