错误:无法找到变量AppTheme_Dark_Dialog

时间:2016-06-29 06:42:33

标签: android

我试图在android studio中创建一个登录活动,但我一直收到这个错误:

  

错误:无法找到符号变量AppTheme_Dark_Dialog

如何解决此错误?

这是我的styles.xml文件:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppBaseTheme" parent="android:Theme.Holo.Dialog" />

1 个答案:

答案 0 :(得分:1)

进入版面编辑器,选择最有可能显示App theme的位置并查找另一个。即使在黑暗中也有很多主题。此外,它只是Holo.Dialog,除非你想要Holo.Light.Dialog的灯光主题。就我所知,Holo.Dark.Dialog与Holo.Dialog相同。

要进行设置,请找到样式xml文件并设置:

<style name="AppBaseTheme" parent="android:Theme.Holo.Dialog">

在未使用v11和v14定义的普通style.xml中,在Android studio中只是空白。

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Holo.Dialog">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="android:Theme.Holo.Dialog">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>

您可能也想查看AppCompat,因为它允许使用例如API 21之前的材料设计。与手动编写不同版本的布局相比,它节省了时间