Example usage for android.app ActionBar setDisplayShowTitleEnabled

List of usage examples for android.app ActionBar setDisplayShowTitleEnabled

Introduction

In this page you can find the example usage for android.app ActionBar setDisplayShowTitleEnabled.

Prototype

public abstract void setDisplayShowTitleEnabled(boolean showTitle);

Source Link

Document

Set whether an activity title/subtitle should be displayed.

Usage

From source file:com.app.blockydemo.ui.fragment.AddBrickFragment.java

private void setUpActionBar() {
    ActionBar actionBar = getActivity().getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    previousActionBarTitle = actionBar.getTitle();
    actionBar.setTitle(this.getArguments().getString(BUNDLE_ARGUMENTS_SELECTED_CATEGORY));
}

From source file:com.rw.barcharttest.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(R.string.app_name);
    }//from w ww.ja v  a 2  s .  c o m
}

From source file:com.herasymc.cmput301counter.CounterSummaryActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_counter_summary);

    list = CounterList.getInstance(getApplicationContext());
    id = (int) getIntent().getLongExtra("id", -1); // if id is -1, summarize all counters

    // Set up the action bar to show a dropdown list.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    // Show the Up button in the action bar.
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Set up the dropdown list navigation in the action bar.
    actionBar.setListNavigationCallbacks(
            // Specify a SpinnerAdapter to populate the dropdown list.
            new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1,//from ww w.j  a v  a  2 s.c o  m
                    new String[] { getString(R.string.title_summary_minute),
                            getString(R.string.title_summary_hour), getString(R.string.title_summary_day),
                            getString(R.string.title_summary_week), getString(R.string.title_summary_month) }),
            this);
}

From source file:com.roque.rueda.notepad.NoteActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_note);

    // Set up the action bar to show a dropdown list.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    //        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);

    mTextFile = new TextFile(this);

    if (savedInstanceState != null) {
        Fragment editTextFragment = new EditTextFragment();
        mTextInput = (TextInput) editTextFragment;
        getSupportFragmentManager().beginTransaction().replace(R.id.container, editTextFragment).commit();

        try {//from w w w . jav a2 s.  c o  m
            String dummyContent = mTextFile.getSDFileContent("test.txt");
            savedInstanceState.putString(Constants.ARG_TEXT_FILE, dummyContent);
        } catch (IOException e) {
            Toast.makeText(this, getString(R.string.error_read_file), Toast.LENGTH_SHORT).show();
        }

    } else {
        Fragment editTextFragment = new EditTextFragment();
        mTextInput = (TextInput) editTextFragment;
        getSupportFragmentManager().beginTransaction().replace(R.id.container, editTextFragment).commit();
    }

    // Set up the dropdown list navigation in the action bar.
    /*actionBar.setListNavigationCallbacks(
        // Specify a SpinnerAdapter to populate the dropdown list.
        new ArrayAdapter<String>(
                getActionBarThemedContextCompat(),
                android.R.layout.simple_list_item_1,
                android.R.id.text1,
                new String[] {
                        getString(R.string.title_section1),
                        getString(R.string.title_section2),
                        getString(R.string.title_section3),
                }),
        this);*/
}

From source file:com.shafiq.mytwittle.view.DirectMessageActivity.java

boolean configureActionBarView() {

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getString(R.string.dm_title) + getOtherUserScreenName());
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    return true;/* www  .  j  a  v a2 s  . co  m*/
}

From source file:it.polimi.spf.app.navigation.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./*w w  w  .j  a va 2 s  .  c  o  m*/
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    //actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}

From source file:com.google.dartino.githubsample.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.
 */// w  w w .j ava  2s .  co  m
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getActivity().getTitle());
}

From source file:com.emotion.emotioncontrol.MainActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);//from w w  w .  ja  v  a2s  .  co m
}

From source file:com.norman0406.slimgress.ActivityOps.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ops);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the app.
    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/*  w w  w. j av a2 s . c  om*/
        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));
    }
}

From source file:org.jorge.lolin1.ui.frags.NavigationDrawerFragment.java

/**
 * Per the navigation drawer design guidelines, updates the action bar to show the actionbar app
 * 'context', rather than just what's in the current screen.
 *///  w  w  w .  j a  va  2  s . c o m
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(Boolean.TRUE);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}