Today I would like to talk how set an image to toolbar. It can help you with branding of your application.

Firstly need to create a project. In this short tutorial I created application from template “Blank Activity” from “File/New Project…” menu item.
Screen Shot 2016-02-17 at 23.37.16

After it need to update layout activity_main.xml. The main idea find place when you use Toolbar

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    app:popupTheme="@style/AppTheme.PopupOverlay" />

and change it to:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    app:popupTheme="@style/AppTheme.PopupOverlay" >

    <ImageView
        android:src="@drawable/header_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar>

In this example for toolbar I used the next image:
header_image

As a result you can see the next image:
device_screen

I hope it was helpful for you.
Have a nice day.

Share Share on Reddit0Share on VKTweet about this on TwitterShare on LinkedIn0Share on Google+7Share on Facebook3Flattr the authorEmail this to someoneShare on Tumblr0