2013-08-30 38 views
4

在我的应用程序中,我将一个android活动定义为dialog.It看起来是正确的。只有问题是我的对话框出现在黑暗主题中。我想把它显示成轻的主题。我通过以下方式定义了我的活动对话框:将android活动定义为轻主题对话框

<activity 
    android:theme="@android:style/Theme.DeviceDefault.Dialog.MinWidth" 
    android:name="com.example.dialog" 
    android:label="@string/title_activity_list" 
    > 
</activity> 

如何执行此操作。任何解决方案需要帮忙。谢谢。

回答

8

您需要使用Holo浅色主题对话:

<activity 
    android:theme="@android:style/Theme.Holo.Light.Dialog" 
    android:name="com.example.dialog" 
    android:label="@string/title_activity_list" /> 
+0

嗨silvia_aut谢谢你的重播。但是,当我尝试这样显示'错误:找不到与给定名称相匹配的资源('主题'的值为'@android:style/Theme.Light.Dialog')。'如何解决这个问题? – nilkash

+1

android:theme =“@ android:style/Theme.Holo.Dialog”这样可以正常运行。如果你想要Light主题,你必须创建自己的自定义主题,比如RobinHood发布。 –

+0

也许这可以帮助你.. http://blog.andromo.com/2011/fixing-text-colours-on-an-alertdialog-when-using-theme-light/ –

0

尝试这可能是帮助你周围

<activity 
    android:theme="@android:style/Theme_Wallpaper" 
    android:name="com.example.dialog" 
    android:label="@string/title_activity_list" 
    > 
</activity> 
3

方法是定义自定义主题到风格的XML,请检查下面的代码: -

风格:

<style name="Theme.D1NoTitleDim" parent="android:style/Theme.Translucent"> 
<item name="android:windowNoTitle">true</item> 
<item name="android:windowContentOverlay">@null</item> 
<item name="android:backgroundDimEnabled">true</item> 
<item name="android:background">#22000000</item> 
</style> 

清单:

<activity 
    android:theme="@style/Theme.D1NoTitleDim" 
    android:name="com.example.dialog" 
    android:label="@string/title_activity_list" 
    > 
</activity> 
1

这也为我工作。我有我的应用程序主题应用于对话框活动。

<style name="Theme.UserDialog" parent="@style/MyAppTheme"> 
    <item name="android:windowFrame">@null</item> 
    <item name="android:windowIsFloating">true</item> 
    <item name="android:windowIsTranslucent">true</item> 
    <item name="android:windowNoTitle">true</item> 
</style>