Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setDisplayHomeAsUpEnabled not displaying back arrow with custom actionbar view

Everything is set properly in the manifest when I click the icon it works as expected, however no < arrow is shown on the ActionBar. Any ideas?

actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(R.layout.actionbar_view);
like image 938
Paul Avatar asked Jan 27 '26 07:01

Paul


1 Answers

The bits you're passing into ActionBar.setDisplayOptions are telling the ActionBar to only show the "home" icon and your custom view. You should also pass in ActionBar.DISPLAY_HOME_AS_UP. As in:

actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP
        | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);

Alternatively, just call ActionBar.setDisplayShowCustomEnabled:

actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(R.layout.actionbar_view);
like image 69
adneal Avatar answered Jan 29 '26 20:01

adneal