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.tweetlanes.android.core.view.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    mSearchTerm = getIntent().getStringExtra("query");
    if (mSearchTerm == null) {
        Uri data = getIntent().getData();
        if (data != null) {
            mSearchTerm = data.toString().replace("com.tweetlanes.android.core.search://", "");
        }/*  w  w  w.j a  va 2  s  . c om*/
    }

    super.onCreate(savedInstanceState);

    // This could be true if loading back into the app from Multitasking
    if (mSearchTerm == null) {
        restartApp();
        return;
    }

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getString(R.string.action_bar_search_title) + " \"" + mSearchTerm + "\"");
    actionBar.setDisplayHomeAsUpEnabled(true);

    mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher);
    updateViewVisibility();
}

From source file:com.albertcbraun.wifidlitedemoapp.MainActivity.java

void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    //noinspection deprecation
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);/*from  w w w  .ja  v a 2 s .  co  m*/
}

From source file:com.tweetlanes.android.core.view.DirectMessageActivity.java

void configureActionBarView() {

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getString(R.string.dm_title) + getOtherUserScreenName());
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
}

From source file:com.swisscom.safeconnect.activity.PipeActivity.java

protected void initActionBar(Activity activity, int stringId, View.OnClickListener listener) {
    ActionBar ab = activity.getActionBar();

    //Tutorial with NoTitle Theme returns null here
    if (ab == null) {
        return;//ww  w .  j a va  2  s  .c o m
    }
    ab.setDisplayShowCustomEnabled(true);
    ab.setDisplayShowTitleEnabled(false);
    ab.setDisplayShowHomeEnabled(false);

    actionBarView = activity.getLayoutInflater().inflate(R.layout.actionbar, null);

    tvTitle = (TextView) actionBarView.findViewById(R.id.tv_title);
    imgBackBtn = (ImageView) actionBarView.findViewById(R.id.img_back_btn);
    if (tvTitle != null && stringId != 0) {
        tvTitle.setText(stringId);
    }

    setOnBackPressedListener(listener);

    ab.setCustomView(actionBarView);
}

From source file:com.xortech.map.MapsWithMe.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // REMOVE THE TITLE BAR FROM THE ACTIONBAR
    ActionBar actionbar = getActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setDisplayShowTitleEnabled(false);

    gps = new GPSTracker(this);

    // MAP TAGS IF THEY ARE AVAILABLE
    MapMyTags();/* w  w w . ja  v  a2  s.  co m*/

}

From source file:org.yuzhiqiang.itsmine.MainActivity.java

public void restoreActionBar() {
    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(getTitle());//from ww  w .jav a  2 s  .  c o  m
    }
}

From source file:com.hellosky.recyclingimageloader.ImageDetailActivity.java

@TargetApi(11)
@Override/*  w w w .ja  v a2 s.c  om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);

    // Fetch screen height and width, to use as our max size when loading images as this
    // activity runs full screen
    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

    // For this sample we'll use half of the longest width to resize our images. As the
    // image scaling ensures the image is larger than this, we should be left with a
    // resolution that is appropriate for both portrait and landscape. For best image quality
    // we shouldn't divide by 2, but this will use more memory and require a larger memory
    // cache.
    final int longest = (height > width ? height : width) / 2;

    mImageLoader = new ImageLoader(this);
    mImageLoader.setImageSize(longest);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), Images.imageUrls.length);
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin));
    mPager.setOffscreenPageLimit(2);

    // Set up activity to go full screen
    getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);

    // Enable some additional newer visibility and ActionBar features to create a more
    // immersive photo viewing experience
    if (Utils.hasHoneycomb()) {
        final ActionBar actionBar = getActionBar();

        // Hide title text and set home as up
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);

        // Hide and show the ActionBar as the visibility changes
        mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int vis) {
                if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                    actionBar.hide();
                } else {
                    actionBar.show();
                }
            }
        });

        // Start low profile mode and hide ActionBar
        mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
        actionBar.hide();
    }

    // Set the current item based on the extra passed in to this activity
    final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1);
    if (extraCurrentItem != -1) {
        mPager.setCurrentItem(extraCurrentItem);
    }
}

From source file:net.pejici.summation.SummationList.java

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

    // Set up the action bar to show a dropdown list.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    recreateSheetsList();/*www  .j av a 2  s.c  om*/
}

From source file:com.albertcbraun.wifidlitedemoapp.fragments.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 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.bignerdranch.android.fragmentbasics.NewsReaderActivity.java

/** Sets up Action Bar (if present).
 *
 * @param showTabs whether to show tabs (if false, will show list).
 * @param selTab the selected tab or list item.
 *//*from   www. j  a  v a2s. c  o  m*/
public void setUpActionBar(boolean showTabs, int selTab) {
    if (Build.VERSION.SDK_INT < 11) {
        // No action bar for you!
        // But do not despair. In this case the layout includes a bar across the
        // top that looks and feels like an action bar, but is made up of regular views.
        return;
    }

    android.app.ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);

    // Set up a CompatActionBarNavHandler to deliver us the Action Bar nagivation events
    CompatActionBarNavHandler handler = new CompatActionBarNavHandler(this);
    if (showTabs) {
        actionBar.setNavigationMode(android.app.ActionBar.NAVIGATION_MODE_TABS);
        int i;
        for (i = 0; i < CATEGORIES.length; i++) {
            actionBar.addTab(actionBar.newTab().setText(CATEGORIES[i]).setTabListener(handler));
        }
        actionBar.setSelectedNavigationItem(selTab);
    } else {
        actionBar.setNavigationMode(android.app.ActionBar.NAVIGATION_MODE_LIST);
        SpinnerAdapter adap = new ArrayAdapter<String>(this, R.layout.actionbar_list_item, CATEGORIES);
        actionBar.setListNavigationCallbacks(adap, handler);
    }

    // Show logo instead of icon+title.
    actionBar.setDisplayUseLogoEnabled(true);
}