Padding / space in Toolbar between icon and title (Android 24)

前端 未结 2 1106
灰色年华
灰色年华 2021-01-18 06:06

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.

Exam

相关标签:
2条回答
  • 2021-01-18 06:43

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

    app:contentInsetStartWithNavigation="0dp"
    
    0 讨论(0)
  • 2021-01-18 07:05

    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>
    
    0 讨论(0)
提交回复
热议问题