当前位置: 首页>>代码示例>>Java>>正文


Java ActionBar.setDisplayShowHomeEnabled方法代码示例

本文整理汇总了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");
    }
}
 
开发者ID:drakeet,项目名称:rebase-android,代码行数:22,代码来源:ToolbarActivity.java

示例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);
            }
        }
    }
}
 
开发者ID:drakeet,项目名称:rebase-android,代码行数:24,代码来源:ToolbarActivity.java

示例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));
                }
            }
        }
    }
 
开发者ID:rudsonlive,项目名称:liveomvp,代码行数:17,代码来源:BaseActivity.java

示例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);
}
 
开发者ID:chrisqz95,项目名称:couch-potatoes,代码行数:19,代码来源:UserGalleryActivity.java

示例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();
  }
}
 
开发者ID:Arjun-sna,项目名称:Android-AudioRecorder-App,代码行数:20,代码来源:PlayListActivity.java

示例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();
    }
}
 
开发者ID:ZafraniTechLLC,项目名称:Companion-For-PUBG-Android,代码行数:27,代码来源:ItemDetailActivity.java

示例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);

}
 
开发者ID:ZafraniTechLLC,项目名称:Companion-For-PUBG-Android,代码行数:21,代码来源:NewsDetailActivity.java

示例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();
}
 
开发者ID:iamjaspreetsingh,项目名称:LifeSaver,代码行数:13,代码来源:Main4Activity.java

示例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.");
    }
}
 
开发者ID:ParaskP7,项目名称:sample-code-posts,代码行数:12,代码来源:AbstractAppActivity.java

示例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();
}
 
开发者ID:graviton57,项目名称:TVGuide,代码行数:12,代码来源:MainActivity.java

示例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);
}
 
开发者ID:Vavassor,项目名称:Tusky,代码行数:29,代码来源:SavedTootActivity.java

示例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);
}
 
开发者ID:shenhuanet,项目名称:PCController-android,代码行数:16,代码来源:ShowPictureActivity.java

示例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);
    }
}
 
开发者ID:shenhuanet,项目名称:Ocr-android,代码行数:10,代码来源:MainActivity.java

示例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());
}
 
开发者ID:hyb1996,项目名称:NodeET,代码行数:13,代码来源:TopicListActivity.java

示例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);
    }
}
 
开发者ID:huazhouwang,项目名称:Synapse,代码行数:8,代码来源:ModelDetailActivity.java


注:本文中的android.support.v7.app.ActionBar.setDisplayShowHomeEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。