當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionBar.setDisplayOptions方法代碼示例

本文整理匯總了Java中android.support.v7.app.ActionBar.setDisplayOptions方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionBar.setDisplayOptions方法的具體用法?Java ActionBar.setDisplayOptions怎麽用?Java ActionBar.setDisplayOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.app.ActionBar的用法示例。


在下文中一共展示了ActionBar.setDisplayOptions方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onResume

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onResume() {
    super.onResume();

    ActionBar actionBar = getSupportActionBar();

    if (actionBar != null && !resumed) {

        // add the custom view to the action bar
        actionBar.setCustomView(R.layout.search_actionbar);

        searchField = (EditText) actionBar.getCustomView().findViewById(R.id.searchField);
        searchField.addTextChangedListener(this);

        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
        actionBar.setDisplayHomeAsUpEnabled(true);

        resumed = true;
    }
}
 
開發者ID:AbyxBelgium,項目名稱:Loyalty,代碼行數:21,代碼來源:SearchResultsActivity.java

示例2: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mAdapter = new CheesesAdapter();

    final ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(mAdapter);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.search_view);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);

    final EditText editText = (EditText) actionBar.getCustomView();
    editText.addTextChangedListener(mTextWatcher);
    editText.requestFocus();
}
 
開發者ID:cyrilmottier,項目名稱:QueryHighlighter,代碼行數:19,代碼來源:MainActivity.java

示例3: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
/**
 * On creation of the activity, set up the action bar title
 * and check that the user has granted permissions for reading
 * external storage.
 * @param savedInstanceState - Bundle
 */
@Override
final protected void onCreate(final Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);
  mLayout = findViewById(R.id.coordinator_layout);

  final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  if (toolbar != null){
    final ActionBar actionBar = (this).getSupportActionBar();
    if (actionBar != null){

      actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
      actionBar.setTitle(R.string.title);
      actionBar.setCustomView(R.layout.logged_in_user);
    }
    toolbar.setNavigationIcon(null);
  }

}
 
開發者ID:Esri,項目名稱:mapbook-android,代碼行數:27,代碼來源:MapbookActivity.java

示例4: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// widget
	this.widget = new Widget(this, this);

	// content view
	setContentView(R.layout.activity_treebolic);
	final ViewGroup container = findViewById(R.id.container);
	final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1.F);
	container.addView(this.widget, params);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);

	// action bar
	setSupportActionBar(toolbar);
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setElevation(0);
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}
}
 
開發者ID:1313ou,項目名稱:Treebolic,代碼行數:27,代碼來源:TreebolicBasicActivity.java

示例5: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_services);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}

	// adapter
	final SimpleAdapter adapter = Services.makeAdapter(this, R.layout.item_services, from, to, true);
	final ListView listView = findViewById(R.id.services);
	listView.setAdapter(adapter);
}
 
開發者ID:1313ou,項目名稱:Treebolic,代碼行數:25,代碼來源:ServicesActivity.java

示例6: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	// super
	super.onCreate(savedInstanceState);

	// toolbar
	setupToolbar(R.layout.toolbar, R.id.toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}

	// read args
	final String action = getIntent().getAction();
	if (action == null)
	{
		SettingsActivity.provider = (HashMap<String, Object>) getIntent().getSerializableExtra(SettingsActivity.ARG_PROVIDER_SELECTED);
	}
}
 
開發者ID:1313ou,項目名稱:Treebolic,代碼行數:25,代碼來源:SettingsActivity.java

示例7: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_providers);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}

	// adapter
	final BaseAdapter adapter = Providers.makeAdapter(this, R.layout.item_providers, from, to, true);
	final ListView listView = findViewById(R.id.providers);
	listView.setAdapter(adapter);
}
 
開發者ID:1313ou,項目名稱:Treebolic,代碼行數:25,代碼來源:ProvidersActivity.java

示例8: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	// super
	super.onCreate(savedInstanceState);

	// toolbar
	setupToolbar(R.layout.toolbar, R.id.toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}
}
 
開發者ID:1313ou,項目名稱:TreebolicPlugins,代碼行數:17,代碼來源:SettingsActivity.java

示例9: initActionBar

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
protected void initActionBar(ActionBar actionBar) {
    if (actionBar == null)
        return;
    if (hasBackButton()) {
        mActionBar.setDisplayHomeAsUpEnabled(true);
        mActionBar.setHomeButtonEnabled(true);
    } else {
        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.setDisplayUseLogoEnabled(false);
        int titleRes = getActionBarTitle();
        if (titleRes != 0) {
            actionBar.setTitle(titleRes);
        }
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:16,代碼來源:BaseActivity.java

示例10: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// widget
	this.widget = new Widget(this, this);

	// content view
	setContentView(R.layout.activity_treebolic);
	final ViewGroup container = findViewById(R.id.container);
	container.addView(this.widget);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);

	// action bar
	setSupportActionBar(toolbar);
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setElevation(0);
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
	}

	// init widget with model is asynchronous
}
 
開發者ID:1313ou,項目名稱:Treebolic,代碼行數:28,代碼來源:TreebolicClientActivity.java

示例11: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_main);

	// toolbar
	final Toolbar toolbar = findViewById(org.treebolic.download.R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
	}

	// initialize
	initialize();

	// check
	Checker.check(this);

	// fragment
	if (savedInstanceState == null)
	{
		PlaceholderFragment fragment = new PlaceholderFragment();
		getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
	}
}
 
開發者ID:1313ou,項目名稱:TreebolicPlugins,代碼行數:33,代碼來源:MainActivity.java

示例12: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	// layout
	setContentView(R.layout.activity_main);

	// toolbar
	final Toolbar toolbar = findViewById(R.id.toolbar);
	setSupportActionBar(toolbar);

	// set up the action bar
	final ActionBar actionBar = getSupportActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
	}

	// initialize
	initialize();

	// check
	Checker.check(this);

	// fragment
	if (savedInstanceState == null)
	{
		PlaceholderFragment fragment = new PlaceholderFragment();
		getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit();
	}
}
 
開發者ID:1313ou,項目名稱:TreebolicPlugins,代碼行數:33,代碼來源:MainActivity.java


注:本文中的android.support.v7.app.ActionBar.setDisplayOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。