Removing left margin from ActionBar home indicator

1.3k views Asked by At

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 ?

1

There are 1 answers

0
s-hunter On

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>