I recently switched instances AlertDialogin my application to use android.support.v7.app.AlertDialog, but I had a problem using a special theme and style for warning dialogs.
In my styles.xml, I have the following style:
<style name="AlertDialog" parent="Theme.AppCompat.Dialog.Alert">
<item name="colorAccent">@color/theme_accent_1</item>
<item name="background">@color/theme_component_background</item>
<item name="android:background">@color/theme_component_background</item>
</style>
In my theme.xml, I have the following set in my theme, if required:
<item name="android:alertDialogTheme">@style/AlertDialog</item>
For some reason, custom styles are never applied to instances AlertDialog, and they remain the default theme Theme.AppCompat.Dialog.Alert.
If I explicitly set the style resource to use as follows, it works:
AlertDialog.Builder builder =
new AlertDialog.Builder(getActivity(), R.style.AlertDialog);
Can't set a default style for the whole theme and not specify the theme in the constructor Builder?