Reputation: 740
In my layout i have an image view at the top without the toolbar. I want to have the back arrow button of toolbar on my imageview, like whatsapp profile view with back arrow on the imageview.
i got the result by adding this
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Upvotes: 0
Views: 3031
Reputation: 3190
Edit your Toolbar
like this.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<ImageView
android:id="@+id/back_button"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/ic_back_button" />
</android.support.v7.widget.Toolbar>
It will be like this .
Also , You will get the Icon from here .
Upvotes: 1
Reputation: 1861
Use the following image and save it to drawable.
and use with the following code
<ImageView
android:id="@+id/back_arrow"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/ic_arrow_back" />
Upvotes: 1