本文整理汇总了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;
}
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
示例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
}
示例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();
}
}
示例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();
}
}