Android Custom Background for Action Bar

/res/drawable/gradient_color.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:angle="0"
        android:startColor="#000000"
        android:endColor="#FFFFFF"/>
</shape>

/res/values/styles.xml

<resources>
    <style name="custom_theme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/custom_color</item>
        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/custom_color</item>
    </style>

    <style name="custom_color" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@drawable/gradient_color</item>
        <!-- Support library compatibility -->
        <item name="background">@drawable/gradient_color</item>
    </style>
</resources>

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="iterator.ir.a041">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/custom_theme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

References
https://github.com/mhdr/AndroidSamples/tree/master/041