This is very simple if you are using Material Theme in your project
Just check first which style are you using in your manifest for your app
It would 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 will probably want to set your parent theme :Theme.AppCompat.Light.DarkActionBar
Note: The colorAccent
attribute will give the desired color to all your widgets
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<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 instead for your whole app theme.
This works for me and its as per Developer Guidelines..As simple as that
Ref: Google Developers