[Android] ToolBar removal of the left margin issue

  • The following settings are invalid

<item name="contentInsetStart">0dp</item>
  • Increase or modify

<item name="contentInsetStartWithNavigation">0dp</item>

 

 Modification method:

1, the increase in styles.xml BaseTheme or the corresponding Activity Theme

<item name="contentInsetStartWithNavigation">0dp</item>

 

2, toolbar in a corresponding increase in the layout file

<androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/white"
            app:layout_scrollFlags="scroll"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            app:title="我是标题"
            app:contentInsetStartWithNavigation="0dp"
            app:titleTextColor="@color/text_black" />

 

Guess you like

Origin www.cnblogs.com/kborid/p/12587304.html