0

How can I add imageview on toolbar that it would be behind drawer and back arrow icons? that imageview should match toolbar height and wouldn't have any margins or padding on left side. I'm trying to achieve this for a while now and only solution I figured out to make custom Toolbar

Example:

Toolbar example

Tadas
  • 7
  • 6

2 Answers2

0

You can try this:

  <RelativeLayout
                android:id="@+id/my_toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:theme="@style/ActionBarThemeOverlay"
                app:popupTheme="@style/ActionBarPopupThemeOverlay"
                android:elevation="4dp"
                android:background="@color/white">

              <ImageView
                    android:layout_width="60dp"
                    android:layout_height="?attr/actionBarSize"
                    android:src="@drawable/yourImage"/>

    </RelativeLayout>
Shiva Snape
  • 544
  • 5
  • 9
0

create appbar_layout_xml in layouts add following code

<android.support.v7.widget.Toolbar 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/my_img"
app:titleTextColor="@color/colorWhite"
android:theme="@style/ThemeOverlay.AppCompat.Light"
>
</android.support.v7.widget.Toolbar>

and in your activity_xml include appbar_layout_xml layout in styles keep theme as NoActionBar