Skip to content Skip to sidebar Skip to footer

Padding / Space In Toolbar Between Icon And Title (android 24)

With the new Android 24, I found out that the icon and title on the Toolbar has a wider padding and I can't find any way to resolve this. Example: MainActivity.java: public class

Solution 1:

You can add this attribute in toolbar to avoid this padding.

app:contentInsetStartWithNavigation="0dp"

Solution 2:

Use below code to remove the extra spacing generated between back arrow and title for Android 24 ( buildToolsVersion 24 / targetSdkVersion 24 )

Do not remove following lines

app:contentInsetStartWithNavigation="0dp"app:contentInsetLeft="0dp"app:contentInsetStart="0dp"

Code

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/red"
    android:minHeight="?attr/actionBarSize"
    app:contentInsetLeft="0dp"
    app:contentInsetStart="0dp"
    app:contentInsetStartWithNavigation="0dp"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

</android.support.v7.widget.Toolbar>

Post a Comment for "Padding / Space In Toolbar Between Icon And Title (android 24)"