如何创建一个Light主题的对话框?

时间:2011-10-06 16:11:04

标签: android android-theme

  

可能重复:
  Light theme for AlertDialog?

我无法找到sdk为对话框提供的Light主题。设置Dialog的样式Theme.Light,使其看起来是一个全屏活动 - 并且似乎没有任何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的轻微属性。

   <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主题的任何建议吗?

0 个答案:

没有答案