Reputation: 2030
In my Nexus 5 (without physical buttons) it's alright, my action bar is as follow:
This is what I want for all devices.
Instead, in devices with physical buttons, this happens:
What should I do to force to show always the home button without the app icon?
The code used to setup the ActionBar in my Activity (in the onCreate() method) is:
private void setupActionBar() {
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(R.layout.action_bar_layout);
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
}
If I change:
actionBar.setDisplayShowHomeEnabled(false);
with:
actionBar.setDisplayShowHomeEnabled(true);
then I obtain that in all devices (both with or without physical buttons):
but I don't want the app icon near the icon with 3 lines!
Upvotes: 0
Views: 1530
Reputation: 2048
Set custom style for ActionBar like this:
<style name="ActionBar" parent="android:Widget.Holo.ActionBar">
...
<item name="android:icon">@android:color/transparent</item> <!-- Hide logo from the action bar -->
</style>
thin set this style in application theme following way:
<item name="android:actionBarStyle">@style/ActionBar</item>
where:
<color name="transparent">#00000000</color>
Good luck!
Upvotes: 1