Reputation: 1556
In android, the default dialog buttons(Negative, neutral and positive) text color is same as colorAccent(in colors.xml) attribute but I want to set some different color without changing colorAccent attribute. I looked everywhere but I couldn't find any way to do this.
Upvotes: 1
Views: 766
Reputation: 971
Specify the alertDialogTheme
in the main AppTheme, and then define a different colorAccent in that theme, which is specific to AlertDialogs:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="alertDialogTheme">@style/AlertDialog</item>
</style>
<style name="AlertDialog" parent="@style/ThemeOverlay.AppCompat.Dialog.Alert">
<item name="colorAccent">@color/yourColor</item>
</style>
Upvotes: 3