So I have set the colors i.e primary
, primaryDark
, accentColor
in the style.xml manually and I can see whole application is taking the colors properly such as toolbar is having the appropriate colors, texts are having appropriate colors. Now, when I am creating a dialogue by java code the colors of the buttons within fragment are very much different from the colors my whole application is having. So why the dialogue is having such different style than of my application. This question will help me in understanding themes, so please answer in such way i.e. behaviour of the themes
in android.
EDIT
The code I am using in styles.xml in my application.
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
The code I am using in colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#675217</color>
<color name="colorPrimaryDark">#261e09</color>
<color name="colorAccent">#ffcb39</color>
<color name="colorTabLayout">#a68425</color>
</resources>
Here are the screenshots of the things I am facing.
First Screen:-
Every thing is fine all the elements have appropriate colors
Second Screen:-
Here The color of the buttons in the pop up dialogue is not the accent color that I have added in styles.xml. Otherwise in first screen you can see different accent color in button text in cardview
.