How to insert `com.gc.materialdesign.views.Switch` in the `Actionbar` using `MenuInflater`??

Below is the code for inflating the android default switch.

This is my `onCreateOptionsMenu`

```
@Override
public boolean onCreateOptionsMenu(Menu menu)
   {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_main, menu);
    MenuItem item = menu.findItem(R.id.myswitch);
    switchButton = (Switch)item.getActionView();
   }

```

This is my `menu_main.xml`

```
<menu  
    xmlns:app="http://schemas.android.com/apk/res-auto"                     
    xmlns:android="http://schemas.android.com/apk/res/android"
    >

    <item
        android:id="@+id/myswitch"
        android:title="off/on"
        app:showAsAction="always"
        app:actionLayout="@layout/switchlayout"
        app:actionViewClass="android.widget.Switch"
        />
</menu>

```

This is the switch layout

```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <Switch
        android:layout_centerVertical="true"
        android:id="@+id/mySwitch"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="off/on toasts" />
</RelativeLayout>

```

Any help is appreciated!