Personally, I have a layout containing my toolbar. I use merge. Something 
like this :

toolbar.xml
<merge
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:minHeight="?attr/actionBarSize"
        android:layout_gravity="center_vertical"
        >
    </android.support.v7.widget.Toolbar>

</merge>

I'm using fragments, so I also declared a default activity layout, 
containing the toolbar and a container for my fragment. So I can reuse it 
easily.

activity_default.xml
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >

    <include
        android:id="@+id/toolbar_container"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        layout="@layout/toolbar"
        />

    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</LinearLayout>

Hope this helps.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to