本文整理汇总了Java中android.support.v7.app.ActionBar.setDisplayShowHomeEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBar.setDisplayShowHomeEnabled方法的具体用法?Java ActionBar.setDisplayShowHomeEnabled怎么用?Java ActionBar.setDisplayShowHomeEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.ActionBar
的用法示例。
在下文中一共展示了ActionBar.setDisplayShowHomeEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void init() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
/* NOTE: Hide the origin title view */
actionBar.setDisplayShowTitleEnabled(false);
}
} else {
Log.e(TAG, "Toolbar == null");
}
}
示例2: setContentView
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public void setContentView(@LayoutRes int layoutResID) {
super.setContentView(layoutResID);
ButterKnife.bind(holder, this);
toolbar = holder.toolbar;
if (toolbar != null) {
setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowHomeEnabled(true);
if (canBack()) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
}
}
示例3: onInitToolbar
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
public void onInitToolbar(Toolbar toolBar, String title, int icon, boolean displayHome) {
if (toolBar != null) {
setSupportActionBar(toolBar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(title);
actionBar.setDisplayShowHomeEnabled(displayHome);
actionBar.setDisplayHomeAsUpEnabled(displayHome);
if (icon != -1 && displayHome) {
toolBar.setNavigationIcon(ContextCompat.getDrawable(this, icon));
}
}
}
}
示例4: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
/**
* Sets up the swipe gallery
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_gallery);
// Creates a back button on the action bar
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
// Instantiate a ViewPager and a PagerAdapter.
mPager = (ViewPager) findViewById(R.id.gallery);
mPagerAdapter = new UserGalleryAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
}
示例5: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record_list);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.tab_title_saved_recordings);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
setNavBarColor();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.record_list_container, PlayListFragment.newInstance())
.commit();
}
}
示例6: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
final Intent intent = getIntent();
if (intent == null) {
throw new IllegalStateException("Missing intent");
}
final Item item = (Item) intent.getSerializableExtra(EXTRA_ITEM);
if (item instanceof Weapon) {
showFragment(WeaponDetailFragment.newInstance((Weapon) item), WeaponDetailFragment.TAG);
} else if (item instanceof Ammo) {
showFragment(AmmoDetailFragment.newInstance((Ammo) item), WeaponDetailFragment.TAG);
} else {
Toast.makeText(this, "We're still working on this feature!", Toast.LENGTH_SHORT).show();
finish();
}
}
示例7: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
final Intent intent = getIntent();
if (intent == null) {
throw new IllegalStateException("Missing intent");
}
final String newsItemSrc = intent.getStringExtra(EXTRA_NEWSITEM_SRC);
showFragment(NewsDetailFragment.newInstance(newsItemSrc), NewsDetailFragment.TAG);
}
示例8: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar=getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
actionBar.setDisplayShowHomeEnabled(true);
setContentView(R.layout.activity_main4);
go();
}
示例9: setToolbar
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
protected void setToolbar(final Toolbar toolbar) {
setSupportActionBar(toolbar);
@Nullable final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
} else {
Timber.w("Cannot get an action bar for this activity; verify that this activity has actually defined a toolbar.");
}
}
示例10: setupToolBar
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setupToolBar() {
progressBar = (ProgressBar) findViewById(R.id.progressBar);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
updateChannelView();
}
示例11: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_saved_toot);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar bar = getSupportActionBar();
if (bar != null) {
bar.setTitle(getString(R.string.title_saved_toot));
bar.setDisplayHomeAsUpEnabled(true);
bar.setDisplayShowHomeEnabled(true);
}
RecyclerView recyclerView = findViewById(R.id.recycler_view);
noContent = findViewById(R.id.no_content);
recyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
DividerItemDecoration divider = new DividerItemDecoration(
this, layoutManager.getOrientation());
Drawable drawable = ThemeUtils.getDrawable(this, R.attr.status_divider_drawable,
R.drawable.status_divider_dark);
divider.setDrawable(drawable);
recyclerView.addItemDecoration(divider);
adapter = new SavedTootAdapter(this);
recyclerView.setAdapter(adapter);
}
示例12: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_showpic);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setTitle("图片");
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowHomeEnabled(true);
}
bitmap = getIntent().getParcelableExtra("img");
mPhotoView.setImageBitmap(bitmap);
}
示例13: onShow
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public void onShow(String title) {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(title);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
}
示例14: setUpToolbar
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setUpToolbar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(mCategoryName);
setSupportActionBar(toolbar);
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
//make Android Studio happy
supportActionBar.setDisplayHomeAsUpEnabled(true);
supportActionBar.setDisplayShowHomeEnabled(true);
}
toolbar.setNavigationOnClickListener(v -> finish());
}
示例15: setUpActionBar
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setUpActionBar() {
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
}