Comment ajouter le bouton de recherche dans la barre d'outils dans la conception de matériel

Je suis en train d'ajouter un bouton de recherche sur le côté gauche de paramètres pop-up, mais je ne suis pas en mesure d'ajouter de la barre d'outils.

Voici mon code de menu.xml :

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.example.materialtheme.MainActivity" >

    <item
        android:id="@+id/action_search"
        android:icon="@drawable/ic_launcher"
        android:menuCategory="secondary"
        android:showAsAction="ifRoom"
        android:title="@string/action_search"/>
    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:showAsAction="never"
        android:title="@string/action_settings"/>

</menu>

et voici mon toolbar.xml :

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    android:minHeight="?attr/actionBarSize"
    android:elevation="4dp"
    local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

Je suis de la barre d'outils mais de ne pas avoir bouton de recherche ?

Veuillez utiliser cette simple wrapper 😉 gist.github.com/ademar111190/7d31dab71502e6a85b8a

OriginalL'auteur nanoweb | 2015-04-27