andreasperelli
andreasperelli

Reputation: 1034

Removing left margin from ActionBar home indicator

I'm currently using this code to hide the default back indicator and using a custom drawable:

actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setIcon(R.drawable.icon_actionbar_menu);

The result is that there's a space between the icon and the left up corner. I would like to remove this space and make the icon starting from the left side with no padding \ margin.

Any suggestions ?

Upvotes: 0

Views: 1360

Answers (1)

s-hunter
s-hunter

Reputation: 25806

The answer from the following posts worked for me on phones but not on tablets:

https://stackoverflow.com/a/31314783/2069407

https://stackoverflow.com/a/31865713/2069407

Set the contentInsetStart and contentInsetEnd to 0dp

<style name="MyActionBar" parent="Widget.AppCompat.ActionBar">
    <item name="contentInsetStart">0dp</item>
    <item name="contentInsetEnd">0dp</item>
</style>

Upvotes: 1

Related Questions