Search code examples
androidactionbarsherlock

actionbar sherlock replace home icon with dropdown icon or remove it completely


I have tried to replace the home icon with a dropdown icon,I have also tried removing it completely but I am unable to achieve it.

the home icon in the above fig ie:


(source: gstatic.com)

needs to be replaced with drop down or completely removed.How do I do it? Thanks in Advance.


Solution

  • You can remove the home action item by calling

    getSupportActionBar().setDisplayShowHomeEnabled(false);

    If you want to replace it with a drop-down menu your best bet would be constructing a Spinner and using the action bar's custom view.

    Spinner dropdown = new Spinner(this);
    //TODO attach to an adapter of some sort
    getSupportActionBar().setCustomView(dropdown);
    getSupportActionBar().setDisplayShowCustomEnabled(true);