<style name="MyAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<!-- Used for the buttons -->
<item name="colorAccent">@color/colorAccent</item>
<!-- Used for the title and text -->
<!-- <item name="android:textColorPrimary">@color/colorAccent</item>-->
<!-- Used for the background -->
<!-- <item name="android:background">@color/white</item>-->
</style>
new AlertDialog.Builder(mActivity, R.style.MyAlertDialogStyle)
.setPositiveButton("好的", (dialog, which) -> dialog.dismiss())
.setCancelable(false)
.setMessage(message)
.show();
注意:以上设置针对android所有版本都能生效。