答案 0 :(得分:4)
您应该为对话框创建自定义样式。例如,像这里:
<style name="AlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:textColor">@color/n1</item>
<item name="android:textColorPrimary">@color/n2</item>
<item name="colorAccent">@color/your_color</item>
</style>
并在对话框片段中设置自定义样式:
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
....
Context context = new ContextThemeWrapper(getContext(), R.style.AlertDialogStyle);
....
}
您也可以从样式中设置它:
<style name="AppTheme" parent="BaseAppTheme">
<item name="alertDialogTheme">@style/AlertDialogStyle</item>
....
</style>