I solved this by changing the theme of activity to light, and then I programmatically set the theme of the warning dialog to one of the dark Android built-in styles:
this.setTheme(android.R.style.Theme_Holo_Dialog);
Since the PreferenceDialog inherits from Dialog, it also sets this theme for all PreferenceDialogs. To be more specific and add style to a specific dialog, you can use ContextThemeWrapper, as used in Dialog.java in the android source:
builder = new AlertDialog.Builder(new ContextThemeWrapper(this, android.R.style.Theme_DeviceDefault_Dialog))
source share