去除左箭头从机器人的动作条?箭头、机器人、动作

2023-09-12 21:53:49 作者:你给的承诺 太肤浅了

我想从所需要的操作栏和唯一的图标和标题拆下左箭头。

I want to remove the left arrow from the action bar and only icon and title needed.

我的code:

getSupportActionBar().setIcon(R.drawable.logo);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setTitle(R.string.dashboardtitle);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);

但是,这并不会删除左箭头。任何帮助!

But this doesn't remove the left arrow . Any help!!

推荐答案

根据规范 机器人规范 : 要启用了导航图标(显示在图标旁边的向上指标),调用setDisplayHomeAsUpEnabled(真正)对你的动作条:

According to specification android specification: To enable the icon for up navigation (which displays the "up" indicator next to the icon), call setDisplayHomeAsUpEnabled(true) on your ActionBar:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    ...
}

所以,你应该将 actionBar.setDisplayHomeAsUpEnabled(假);

更新: 我测试下一个code与动作条福尔摩斯和它的工作。没有回头箭:

UPDATE: I test next code with ActionBar sherlock and it's work. There is no back arrow:

getSupportActionBar().setIcon(R.drawable.ic_launcher);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setTitle(R.string.about_event_location);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);