Reputation: 159
Does anyone know how to reduce the padding between de navigation icon and logo on a toolbar. for some reason it seems like there is way more space between them then between my logo and title.
I've already tried to add a style and use contentInset but none of them seem to work.
My layout
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/background_grey"
android:style="@style/ToolbarTheme"
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
app:logo="@drawable/ic_launcher">
</android.support.v7.widget.Toolbar>
My style
<style name="ToolbarTheme" parent="Theme.AppCompat">
<item name="android:minWidth">0dip</item>
<item name="android:paddingLeft">0dip</item>
<item name="android:paddingRight">0dip</item>
</style>
Image (Space indicated by red lines should be smaller)
Upvotes: 4
Views: 9753
Reputation: 17841
If you are interested only in Reducing padding between navigation icon and logo on my toolbar, use
Toolbar.setContentInsetStartWithNavigation(0)
Unlike
contentInsetStart
, this will modify the inset only when there is a Navigation Icon. In the absence of the Navigation Icon, you will still have the 16dp start inset.
Upvotes: 16
Reputation: 25312
Just add app:contentInsetStart="0dp"
in your toolbar xml.
Before adding app:contentInsetStart="0dp"
Output is:
After adding app:contentInsetStart="0dp"
Output is:
Upvotes: 0