去除左箭头从机器人的动作条? [英] Removing left arrow from the actionbar in android?

查看:74
本文介绍了去除左箭头从机器人的动作条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

这篇关于去除左箭头从机器人的动作条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆