It is very simple if you use the material theme in your project.
Just check what style you use in the manifest for your application. It will be something like below:
<application android:allowBackup="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">
Now follow @style/AppTheme
You might want to install the parent theme: Theme.AppCompat.Light.DarkActionBar
Note. The colorAccent
attribute will give the desired color to all your widgets.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color/PrimaryColor</item> <item name="colorPrimaryDark">@color/DarkPrimaryColor</item> <item name="colorAccent">@color/DarkPrimaryColor</item> <item name="android:textColorSecondary">@color/PrimaryColor</item> <item name="android:itemBackground">@color/DarkPrimaryColor</item> <item name="android:textColor">@color/TextIconsColor</item> </style>
So, if you want, you can create this custom theme for your layouts or activities for the entire theme of the application.
This works for me and its as recommended by the developer. Link: Google Developers
source share