1

I am trying to align imageview to the extreme left of my toolbar but it's not happening. I tried other solutions on stackoverflow but none is working for me

check out this image

<android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="#fff"
        android:elevation="4dp"
        android:gravity="start"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:weightSum="10">

            <ImageView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="start"
                android:layout_weight="2"
                android:padding="10dp"
                android:src="@drawable/app_icon_book_sumary_one" />
        </LinearLayout>
    </android.support.v7.widget.Toolbar>
2

2 Answers 2

10

Adding these 2 lines inside toolbar worked

app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
1
  • for me only the line already app:contentInsetStart="0dp" solved the problem Commented Jan 10, 2018 at 22:06
2

Set this attribute on your toolbar

app:contentInsetStartWithNavigation="0dp
4
  • it doesn't work... toolbar is already on extreme left but in the LinearLayout there is some margin, i dont know why Commented Sep 26, 2017 at 14:30
  • I can see on your picture that the toolbar is not aligned to the left completely
    – Tim
    Commented Sep 26, 2017 at 14:49
  • my cursor is on LinearLayout so it is showing the border of linear layout. When the cursor is on toolbar the border moves to the extreme left. :) Commented Sep 26, 2017 at 14:59
  • then try paddingStart="0dp" on the toolbar
    – Tim
    Commented Sep 26, 2017 at 15:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.