Open elboyev opened 2 years ago
I have two themes.xml, day and night. And I tried to add custom material dialog items to themes.xml but style did not change <resources xmlns:tools="http://schemas.android.com/tools"> <!-- Base application theme. --> <style name="Theme.DANISHBETON" parent="Theme.MaterialComponents.Light.NoActionBar"> <!-- Primary brand color. --> <item name="colorPrimary">@color/purple_500</item> <item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorOnPrimary">@color/white</item> <!-- Secondary brand color. --> <item name="colorSecondary">@color/teal_200</item> <item name="colorSecondaryVariant">@color/teal_700</item> <item name="colorOnSecondary">@color/black</item> <!-- Status bar color. --> <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> <!-- MD. --> <item name="material_dialog_background">#FFFFFF</item> <item name="material_dialog_title_text_color">#000000</item> <item name="material_dialog_message_text_color">#5F5F5F</item> <item name="material_dialog_positive_button_color">@color/danisred</item> <item name="material_dialog_positive_button_text_color">#FFFFFF</item> <item name="material_dialog_negative_button_text_color">@color/danisred</item> </style> <resources>
I have two themes.xml, day and night. And I tried to add custom material dialog items to themes.xml but style did not change
<resources xmlns:tools="http://schemas.android.com/tools"> <!-- Base application theme. --> <style name="Theme.DANISHBETON" parent="Theme.MaterialComponents.Light.NoActionBar"> <!-- Primary brand color. --> <item name="colorPrimary">@color/purple_500</item> <item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorOnPrimary">@color/white</item> <!-- Secondary brand color. --> <item name="colorSecondary">@color/teal_200</item> <item name="colorSecondaryVariant">@color/teal_700</item> <item name="colorOnSecondary">@color/black</item> <!-- Status bar color. --> <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <!-- Customize your theme here. --> <!-- MD. --> <item name="material_dialog_background">#FFFFFF</item> <item name="material_dialog_title_text_color">#000000</item> <item name="material_dialog_message_text_color">#5F5F5F</item> <item name="material_dialog_positive_button_color">@color/danisred</item> <item name="material_dialog_positive_button_text_color">#FFFFFF</item> <item name="material_dialog_negative_button_text_color">@color/danisred</item> </style> <resources>
Oh! I found out how to do it. You add this line to the bottom of the theme: ?attr/colorPrimaryVariant
That's because I'm using the latest Android Studio Version.