ankita kedia
ankita kedia

Reputation: 128

Error: cannot find variable AppTheme_Dark_Dialog

I'm trying to create a login activity in android studio and I keep getting this error:

error: cannot find symbol variable AppTheme_Dark_Dialog

How do I resolve this error?

This is my styles.xml file :

<!-- 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" />

Upvotes: 2

Views: 3603

Answers (1)

Zoe - Save the data dump
Zoe - Save the data dump

Reputation: 28268

Go into the layout editor, select where it most likely says App theme and look for another one. There are a lot of themes even on dark. Further, it is just Holo.Dialog unless you want the light theme which is Holo.Light.Dialog. Holo.Dark.Dialog is the same as Holo.Dialog as far as I can tell.

To set it, find the style xml files and set:

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

In the normal style.xml that is not defined with v11 and v14, just blank in 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>

You may want to look into AppCompat as well, as it allows the use of e.g. material design before API 21. And it saves time compared to manually writing layouts for the different versions

Upvotes: 1

Related Questions