Home » Android » android – Missing styles. Is the correct theme chosen for this layout?

android – Missing styles. Is the correct theme chosen for this layout?

Posted by: admin March 10, 2020 Leave a comment


Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style mapViewStyle in current theme.

I tried every solutions available to solve this problem but nothing seems to work. I have included library in the manifest file. I even created style is styles.xml, I have chosen Google Apis build target as well.

Can somebody please give me a solution. Thank you in advance for your valuable time.

here is my xml file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" >

     android:apiKey="here i have my key"
     android:enabled="true" />


Here is my manifest snippet:

  <uses-library android:name="com.google.android.maps" />

        android:label="@string/title_activity_main" >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
    <activity android:name=".Second" />

    <activity android:name=".Third"  android:theme="@android:style/Theme.Black"/>

here is my style.xml file

    <style name="mapViewStyle" parent="@android:style/Theme.Black">
How to&Answers:

For Android Studio (or IntelliJ IDEA),

If everything looks OK in your project and you’re still receiving the error in your layouts, try to ‘Invalidate caches & restart’.

Enjoy a coffee while Android Studio is recreating caches & indexes.

how to invalidate cache & restart


I had the same problem and found it was the Theme dropdown at the top of the graphical layout editor. I changed from Holo to Theme and the layout displayed and error disappeared.


What I usually do is the following: a Gradle Clean, Rebuild and Sync all my Gradle files. After that I restart Android Studio, and I go to:

Select Theme -> Project Themes -> AppTheme


This is because you select not a theme of your project. Try to do next:

enter image description here


If we are creating too many projects using Android Studio sometime Rendering issue comes. Even creating a blank activity we receive such rendering error.
Please shut down and restart Android studio. In case the issue persists you can Android Studio Cache Invalidation and Restart

Hope this helps. It works similar fashion as rule of thumb, in case all looks good and still error persists a restart of application usually resolves the issue.


In my case the problem occurred while the default setting for Android Version in the Designer was set to ‘Preview N’. Changed Android Version to ’23’ and the error notification went away.

And don’t forget to uncheck ‘Automatically Pick Best’.


I had the same problem using Android Studio 1.5.1.

This was solved by using the Android SDK Manager and updating Android Support Library, as well as Local Maven repository for Support Libraries.

enter image description here

After updating the SDK and restarting Android Studio, the problem was rectified.

Hope this helps anyone who has the same problem after trying other suggestions.


I solved it by changing “classpath” in “dependencies” in build.gradles.

Just change:

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.0-alpha2'

or something like that to:

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'


I got this error after overriding action bar style like this. Also i lost action bar in preview.

<style name="general_app_theme" parent="@style/Theme.AppCompat">
    <!-- for API level 11 -->
    <item name="android:actionBarStyle">@style/action_bar_style</item>

    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/action_bar_style</item>


<style name="action_bar_style" parent="@style/Widget.AppCompat.ActionBar">
    <!-- for API level 11 -->
    <item name="android:height">@dimen/action_bar_height</item>
    <item name="android:background">@color/action_bar_color</item>
    <item name="android:displayOptions">showTitle</item>

    <!-- Support library compatibility -->
    <item name="displayOptions">showTitle</item>

So, problem is overriding theme by my custom. this is the reason, why I’ve changed AppCompat (from “Project Themes”) to general_app_theme (from “Manifest Themes”). Now I have no this error and action bar in preview come back.


Try switching the theme in the design view to one of the options in “Manifest Themes”. I’m guessing this is Because you are inheriting the theme from the manifest to support multiple api levels. It worked for me anyway.


With reference to the answer provided by @Benno:
Instead of changing to a specific theme, you can simply choose ‘DeviceDefault’ from the theme menu. This should choose the theme most compatible with the emulated device.


If you still have the problem after trying all the solutions above, please try modify the API Level as shown below. Incorrect API Level may also cause the problem.

enter image description here


It can be fixed by changing your theme in styles.xml from
Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar

<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 name="AppTheme" parent="Base.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>

and clean the project. It will surely help.


Most of the errors in XML happen due to the names you have given to the resources.

Images stored in the drawable folder need to be named in a proper manner.
just check these things:

  1. Are there any duplicate files? if so remove the duplicates. (For example "image.jpg" and "image.png" are not allowed in the same time. It will not show any errors but sometimes it will show that R.java cannot be resolved)
  2. Do the filenames contains any uppercase letters? If so right click on that file->refactor->rename
    and rename it with all lowercase, no hyphens, and only a-z and 0-9 are allowed.

Just make sure of the above cases.


I got the same problem with my customized theme that used Holo.Light as its parent. In grayed text Android Studio indicated that some attributes were missing. When I added these missing attributes as follows, the rendering problems went away –

    <item name="android:textEditSuggestionItemLayout"></item>
    <item name="android:textEditSuggestionContainerLayout"></item>
    <item name="android:textEditSuggestionHighlightStyle"></item>

Even though they introduced errors in my style’s theme, they caused no problems in rendering the activity designs or building my app.


You can simply remove this error through change “App theme” and select any theme such as light. This error will be removed.


I meet the same problem.Select theme to another one in preview can solve problem temporary.Like the image

Finally,I found out that there are AppTheme and AppBaseTheme in my styles.xml.
And AppTheme has parent AppBaseTheme.
The AppBaseTheme has parent of one system style.

And every layout file use the theme AppTheme.
Just change AppTheme‘s parent to AppBaseTheme‘s parent.
It solve the problem permanent.


Just need click button ‘AppTheme‘, and choose ‘Manifest Themes‘. It works in most cases.


For me, it was occurring on menu.xml file as i was using android:Theme.Light as my theme, So what i did was –

  1. Added new Folder in res directory named values-v21.

  2. Added android:Theme.Material.Light as AppTheme in styles.xml.


This is very late but i like to share my experience this same issue.
i face the same issue in Android studio i tried to some other solution that i found in internet but nothing works for me unless i REBUILD THE PROJECT and it solve my issue.

Hope this will works for you too.

Happy coding.


Change your App theme to AppCombat..
enter image description here