UPDATE:
Create a new file in the layouts folder named tool_bar.xml and paste the following code:
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar android:layout_height="wrap_content" android:layout_width="match_parent" android:background="@color/ColorPrimary" android:elevation="2dp" android:theme="@style/Base.ThemeOverlay.AppCompat.Dark" xmlns:android="http://schemas.android.com/apk/res/android" />
Add these colors to your color.xml file:
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="ColorPrimary">#00897B</color> <color name="ColorPrimaryDark">#00695C</color> </resources>
This is the code for the styles.xml file:
<resources> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/ColorPrimary</item> <item name="colorPrimaryDark">@color/ColorPrimaryDark</item> </style>
You must add the following code to the MainActivity.xml file:
<include android:id="@+id/tool_bar" layout="@layout/tool_bar" android:layout_height="wrap_content" android:layout_width="match_parent" />
This method worked for me!
This should give you an action bar that looks like the one below the result

source share