可能重复:
AlertDialog 的轻主题?
我一直无法找到 sdk 为对话框提供的 Light Theme。设置 Dialog 的样式 Theme.Light,使其看起来像是一个全屏 Activity——而且似乎没有任何 Theme.LightDialog 可用。
有人建议我创建自己的 LightDialog 主题。为了做到这一点,我尝试了: 1. 扩展 android 的 Theme.Light 并从 Theme.Dialog 添加对话属性
<style name="Theme.LightDialog" parent="@android:style/Theme.Light">
<item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@android:style/DialogWindowTitle</item>
<item name="android:windowBackground">@android:drawable/panel_background</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
</style>
...和 2. 扩展 android 的 Theme.Dialog 并添加来自 Theme.Light 的 lighty 属性。
<style name="Theme.LightDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/screen_background_light</item>
<item name="android:colorBackground">@android:color/background_light</item>
<item name="android:colorForeground">@androidcolor/bright_foreground_light</item>
<item name="android:colorForegroundInverse">@android:color/bright_foreground_light_inverse</item>
<item name="android:textColorPrimary">@android:color/primary_text_light</item>
<item name="android:textColorSecondary">@android:color/secondary_text_light</item>
<item name="android:textColorTertiary">@android:color/tertiary_text_light</item>
<item name="android:textColorPrimaryInverse">@android:color/primary_text_dark</item>
<item name="android:textColorSecondaryInverse">@android:color/secondary_text_dark</item>
<item name="android:textColorTertiaryInverse">@android:color/tertiary_text_dark</item>
<item name="android:textColorPrimaryDisableOnly">@android:color/primary_text_light_disable_only</item>
<item name="android:textColorPrimaryInverseDisableOnly">@android:color/primary_text_dark_disable_only</item>
<item name="android:textColorPrimaryNoDisable">@android:color/primary_text_light_nodisable</item>
<item name="android:textColorSecondaryNoDisable">@android:color/secondary_text_light_nodisable</item>
<item name="android:textColorPrimaryInverseNoDisable">@android:color/primary_text_dark_nodisable</item>
<item name="android:textColorSecondaryInverseNoDisable">@android:color/secondary_text_dark_nodisable</item>
<item name="android:textColorHint">@android:color/hint_foreground_light</item>
<item name="android:textColorHintInverse">@android:color/hint_foreground_dark</item>
</style>
这两次尝试都失败了,因为它们使用了非公共属性。关于如何创建 LightDialog 主题的任何建议?