How do I get rid of the extra padding in the new Toolbar with Android SDK API version 21 (the support library)? I am talking about the red arrows on this picture: Here is the code I am using:
As you can see I've set all the relevant padding to 0, but there is still padding around the Spinner. What have I done wrong or what do I need to do to get rid of the extra padding? Edit Some have questioned why I am trying to do this. As per the Material Design specs, the spinner should be 72dp from the left side I need to neutralize the padding Google have put there in order to properly place my spinner: Edit 2 As per Chris Bane's answer below I set the contentInsetStart to 0. For the support library you will need to use the app namespace:
I hope this helps someone, it had me confused for several days. |
|||||||||
|
The left inset is caused by Toolbar's Change this to 72dp to align to the keyline. Update for support library v24.0.0: To match the Material Design spec there's an additional attribute |
|||||||||||||||||||||
|
Above answer is correct but there is still one thing that might create issues (At least it did create an issue for me) I used the following and it doesn't work properly on older devices -
The trick is here just use the following -
and get rid of -
And now it should work fine throughout all the devices. Hope it helps. |
|||||||||||||||||||||
|
Make your toolbar like:
You need to add
attribute to add spacing please follow this link for more - Android Tips
|