0

I have a custom title bar, a simple relative layout, that I set as the custom title bar of my activity. But at want the android BackAsUp icon < to show up as usual (i.e. to the left of my custom layout). How do I do that? here is my code so far.

    this.getActionBar().setDisplayShowCustomEnabled(true);
    this.getActionBar().setDisplayShowTitleEnabled(false);
    LayoutInflater inflator = (LayoutInflater) this
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = inflator.inflate(R.layout.my_title_bar, null);
    this.getActionBar().setCustomView(v);

Update:

I have tried the answer at Remove Icon but have HomeAsUp in ActionBar they don't work. So one question, is order of setting those flags matter?

Community
  • 1
  • 1
Cote Mounyo
  • 13,817
  • 23
  • 66
  • 87
  • I'm not sure but did you try just including `getActionBar().setDisplayHomeAsUpEnabled(true);` and `getActionBar().setDisplayShowHomeEnabled(true);` ? – Shobhit Puri Aug 27 '13 at 23:21
  • Yes. But then it shows the logo as well. Then I set `this.getActionBar().setDisplayUseLogoEnabled(false);` but it still shows the logo. I am trying to figure out how to set the logo to null. – Cote Mounyo Aug 27 '13 at 23:25
  • `this.getActionBar().setLogo(null);` does not help either. – Cote Mounyo Aug 27 '13 at 23:28
  • Did you try to set the icon as transparent? You can also do it in `styles.xml` and set the style for Action bar likw `@android:color/transparent ` . See http://stackoverflow.com/a/14998204/1306419 – Shobhit Puri Aug 27 '13 at 23:51

1 Answers1

0

Adding the following combo solved the problem.

getActionBar().setIcon(
               new ColorDrawable(getResources().getColor(android.R.color.transparent)));
        this.getActionBar().setDisplayShowHomeEnabled(true);
Cote Mounyo
  • 13,817
  • 23
  • 66
  • 87