【问题标题】:Back Arrow in Action bar Sherlock is not displaying操作栏中的返回箭头 Sherlock 未显示
【发布时间】:2012-12-13 11:44:33
【问题描述】:

在我的项目中,我使用了动作栏 sherlock 库。我想在我使用以下代码的操作栏中制作后退按钮

getSupportActionBar().setHomeButtonEnabled(true);

@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {

        case android.R.id.home:
             finish();
             break;

        default:
            return super.onOptionsItemSelected(item);
        }
        return false;
    }

一切正常,但没有显示返回箭头(图标左侧)。我也想展示 Back Arrow。谁能告诉我我做错了什么。

【问题讨论】:

    标签: android actionbarsherlock


    【解决方案1】:

    你必须这样设置:

    ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
    

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-26
      • 2013-06-06
      • 1970-01-01
      • 2013-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多