I want to remove the left padding that the navigation drawer adds automatically. I tried adding
android:padding="0dp"
and margins of 0dp to the elements but there seems to be a little bit of space on the left of the drawer header. Is there something I'm missing?
Here's the header code
<androidx.appcompat.widget.Toolbar
android:id="@ id/report_toolbar"
android:layout_height="@dimen/toolbar_height"
android:layout_width="match_parent"
android:background="@color/accent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageButton
android:id="@ id/navigation_fllesh_button"
android:layout_width="@dimen/side_button_size"
android:layout_height="@dimen/side_button_size"
android:background="@android:color/transparent"
android:src="@drawable/ic_foreground_logo"
android:contentDescription="@string/drawer_closing_button_description"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:tint="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:fontFamily="@font/addingtoncf_bold"
android:gravity="center"
android:text="@string/app_title"
android:textColor="@color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@ id/navigation_fllesh_button"
app:layout_constraintStart_toEndOf="@ id/navigation_fllesh_button"
app:layout_constraintTop_toTopOf="@ id/navigation_fllesh_button" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.appcompat.widget.Toolbar>
and here is the extra padding:
This is the design view
And this is the blueprint view
CodePudding user response:
As you want to remove the toolbar margin from left try to remove it with the help of contentinsert padding to, by setting 0dp.
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetRight="0dp"
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp"
android:paddingLeft="0dp"
If still the problem still there then set contentInsetStartWithNavigation to zero
app:contentInsetStartWithNavigation="0dp"
Hope it will solve your issue.
