Android: Remove Left Margin from Actionbar's Custom Layout

Android: remove left margin from actionbar's custom layout

If you are adding the Toolbar via XML, you can simply add XML attributes to remove content insets.

<android.support.v7.widget.Toolbar
xmlns:app="schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primaryColor"
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetRight="0dp"
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp" />

How to remove space in left and right side of Action Bar when used custom layout for action bar?

If you want more customization on ActionBar, Use the ToolBar as an Actionbar which is more customizable than the default ActionBar.

reduce left margin of navigation icon of toolbar in android

add these line into your toolbar xml

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


Related Topics



Leave a reply



Submit