Charl Potgieter
Charl Potgieter

Reputation: 211

Add icons left of toolbar Android (xamarin)

I downloaded a sample for the new v7 Toolbar. I can add a custom icon to the right but I don't know how to add it to the left.(s Please view this image to see how it currently looks http://postimg.org/image/qnf67g4tz/ Code I am using is here.

<?xml version="1.0" encoding="utf-8" ?> 
    <menu xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:local="http://schemas.android.com/apk/res-auto">
       <item
          android:id="@+id/menu_share"
          android:icon="@drawable/ic_action_content_create"
          android:background="@android:color/holo_blue_light"
          local:showAsAction="ifRoom"
          android:title="Share" />
    </menu>

And: LayoutInflater inflater = (LayoutInflater)Maincontext.GetSystemService (Context.LayoutInflaterService); View v = inflater.Inflate (Resource.Layout.toolbar,null); Toolbar toolbar = v.FindViewById (Resource.Id.toolbar); toolbar.Title = title; toolbar.SetTitleTextColor (Color.White); toolbar.InflateMenu (Resource.Menu.home);

Upvotes: 0

Views: 3345

Answers (1)

Abhishek
Abhishek

Reputation: 2370

xml code for back arrow icon

<android.support.v7.widget.Toolbar
            android:id="@+id/product_toolBar_title"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:fitsSystemWindows="true"
            app:layout_collapseMode="pin"
            app:navigationIcon="@drawable/ic_arrow_back_white_24dp"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>

Upvotes: 2

Related Questions