更改默认对话框按钮的文本颜色而不更改colorAccent属性
在android中,默认对话框按钮(负,中性和正)文本颜色与colorAccent(在colors.xml)属性中相同,但我想设置一些不同的颜色而不更改colorAccent属性。我到处寻找,但我找不到任何方式来做到这一点。更改默认对话框按钮的文本颜色而不更改colorAccent属性
指定主AppTheme的alertDialogTheme
,然后在这个主题,这是具体到AlertDialogs定义不同colorAccent:
<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>
谢谢你回答,但它不工作。 @gurgen –
我之前检查过它,再次检查。你使用AlertDialog v7吗? –
不,我正在使用'android.app.AlertDialog'。我应该使用什么? –
的[我怎样才能改变默认对话框按钮上的文字可能的复制颜色在Android 5](https://stackoverflow.com/questions/27965662/how-can-i-change-default-dialog-button-text-color-in-android-5) –
这是非常不同的问题,从什么你说它是重复@Amin –