layout下的layout_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:andro>
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <android.support.v7.widget.Toolbar
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/my_toolbar"
        android:layout_height="?attr/actionBarSize"
        android:layout_width="match_parent"
        android:background="?attr/colorPrimary"
        android:gravity="left|start"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

        <android.support.v7.widget.ActionMenuView
            android:id="@+id/amvMenu"
            android:layout_width="wrap_content"
            android:layout_height="?attr/actionBarSize"/>
    </android.support.v7.widget.Toolbar>

    <TextView
        android:layout_below="@+id/my_toolbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="hello_world" />
</RelativeLayout>
View Code

相关文章: