I am having an issue with the Android v7 support toolbar. When I activate the home as up button and showing it (see Java code below), there is an extra padding for the content of the toolbar which is an Image view. I would like to remove the Imageview left extra padding.
I already tried the attributes, nothing changed:
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
Notice that when I use these attributes without the home as up, it works and there is no padding.
XML:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/toolbarBackground"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icn_photo"
android:padding="0dp"/>
</android.support.v7.widget.Toolbar>
JAVA:
setSupportActionBar(binding.toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
How could I solve my problem?
Edit This question is different from Android API 21 Toolbar Padding because in my case I need to conserve the home as up (back) button.