If your phone is API 19 ,this is what i do ,first write your style 
<style name="DayTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/primary</item>
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorAccent">@color/accent</item>
        <item name="background">@color/white</item>
        <item name="barTitleColor">@color/bar_title</item>
        <item name="barColor">@color/primary</item>
        <item name="textColor">@color/text_color</item>
        <item name="textLight">@color/text_light</item>
        <item name="textBright">@color/primary</item>
        <item name="dividerColor">@color/dividerColor</item>
    </style>
then the attr.xml : 
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="barTitleColor" format="color"/>
    <attr name="textColor" format="color"/>
    <attr name="textLight" format="color"/>
    <attr name="textBright" format="color"/>
    <attr name="dividerColor" format="color"/>
    <attr name="barColor" format="color"/>
</resources>
then my UI xml : 
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:background="?attr/barColor"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        >
        <android.support.v7.widget.Toolbar
            app:contentInsetStart="0dp"
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorPrimary"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            />
</android.support.design.widget.AppBarLayout>
this is what i learn from Leisure, 
android:background="?attr/barColor"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
this is one of answers, but i don't know why it can do it