Example usage for android.support.v4.app ActionBar DISPLAY_SHOW_CUSTOM

List of usage examples for android.support.v4.app ActionBar DISPLAY_SHOW_CUSTOM

Introduction

In this page you can find the example usage for android.support.v4.app ActionBar DISPLAY_SHOW_CUSTOM.

Prototype

int DISPLAY_SHOW_CUSTOM

To view the source code for android.support.v4.app ActionBar DISPLAY_SHOW_CUSTOM.

Click Source Link

Document

Show the custom view if one has been set.

Usage

From source file:com.actionbarsherlock.sample.hcgallery.MainActivity.java

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

    if (savedInstanceState != null && savedInstanceState.getInt("theme", -1) != -1) {
        mThemeId = savedInstanceState.getInt("theme");
        this.setTheme(mThemeId);
    }/*from  ww w  .  ja v  a 2s .  co m*/

    setContentView(R.layout.main);

    Directory.initializeDirectory();

    ActionBar bar = getSupportActionBar();

    int i;
    for (i = 0; i < Directory.getCategoryCount(); i++) {
        bar.addTab(bar.newTab().setText(Directory.getCategory(i).getName()).setTabListener(this));
    }

    mActionBarView = getLayoutInflater().inflate(R.layout.action_bar_custom, null);

    bar.setCustomView(mActionBarView);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowHomeEnabled(true);

    // If category is not saved to the savedInstanceState,
    // 0 is returned by default.
    if (savedInstanceState != null) {
        int category = savedInstanceState.getInt("category");
        bar.selectTab(bar.getTabAt(category));
    }
}

From source file:org.androidui.app.ActionBarImpl.java

@Override
public void setDisplayShowCustomEnabled(boolean showCustom) {
    setDisplayOptions(showCustom ? ActionBar.DISPLAY_SHOW_CUSTOM : 0, ActionBar.DISPLAY_SHOW_CUSTOM);
}