XML : How to put imageView in extreme left of toolbar?

I am trying to put my ImageView Content in extreme left of my toolbar. How can i do so? I have tried the following code: This is my ToolBar:

  <?xml version="1.0" encoding="utf-8"?>  <android.support.v7.widget.Toolbar  xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:background="@color/colorPrimary"  android:elevation="4dp"  >    <ImageView      android:layout_width="50dp"      android:layout_height="50dp"      android:text="Departure"      android:src="@drawable/abc"      android:scaleType="fitCenter"      android:layout_gravity="left"      android:id="@+id/toolbar_image"      />      </android.support.v7.widget.Toolbar>    

This is my activity_main.xml

  <?xml version="1.0" encoding="utf-8"?>  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="match_parent"  android:layout_height="match_parent"  xmlns:tools="http://schemas.android.com/tools"  android:orientation="vertical"  tools:context=".MainActivity">    <include      android:id="@+id/tool_bar"      layout="@layout/toolbar"        ></include>    <ListView      android:layout_width="match_parent"      android:layout_height="0dp"      android:layout_weight="1"      android:id="@+id/listview">    </ListView>  </LinearLayout>    

This is my menu.xml

  <menu  xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  xmlns:tools="http://schemas.android.com/tools"  tools:context=".MainActivity">    <item      android:id="@+id/action_settings"      android:orderInCategory="100"      android:title="refresh"      app:showAsAction="never" />  <item      android:id="@+id/action_search"      android:orderInCategory="200"      android:title="Search"      app:showAsAction="ifRoom"      ></item>  <item      android:id="@+id/action_user"      android:orderInCategory="300"      android:title="User"        app:showAsAction="ifRoom"></item>    </menu>    

And my output is like This is the image is on Right Side of my app Name enter image description here

No comments:

Post a Comment