Question

[Solved] Android Studio: Rendering Problems Missing styles-correct theme chosen for this layout, Failed to find style with id

I want to create card item xml layout for CardView and getting this error. Common solutions here not worked (tried them all and others from similar posts).

This is my xml:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="3dp"
        card_view:cardElevation="4dp">


    </android.support.v7.widget.CardView>
</RelativeLayout>

This is the relevant part of styles.xml:

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

<!--Theme for Tool Bar (Action Bar)-->
<style name="ToolBarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
    <item name="android:textColorPrimary">@color/white</item>
</style>

This is the relevant part from the Manifest:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

This is the relevant part from gradle build script:

compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'

And this is the error:

enter image description here

Thanks,

Enquirer: michael

||

Solution #1:

I was also facing the same issue. Please restart Android Studio by selecting the menu option “File” ? “Invalidate Caches / Restart”. For more details please follow the link:

http://www.unknownerror.org/opensource/harvesthq/chosen/q/stackoverflow/13439486/missing-styles-is-the-correct-theme-chosen-for-this-layout

Respondent: AVINASH SHRIMALI

Solution #2:

You can solve this problem by changing current theme to suitable themes. Every theme is not suitable for every type of view. By using theme combobox we can solve this.
Here is the problem
enter image description here

1. Firstly go theme bar and press it

enter image description here

2. Change your theme like in the picture below
enter image description here
Now you changed your theme. If selected theme is suitable with your view it will render.

enter image description here

Respondent: Harun ERGUL

Solution #3:

I also faced the same error, what i did is i made the layout theme similar to the theme i am having in manifest.xml and it worked for me.

Respondent: Ironman

Solution #4:

I face a similar issue what I did was click on Refresh button.enter image description here

If the problem still persists try Invalidate Caches and restart

Respondent: Nikhil

Solution #5:

I had faced same issue and i've tried many solution. First of all if you creates themes in res file so, locate it in manifext file with  android:theme="@style/Theme.xyz" and in to layout design you have to check the same theme is applied there or not. this solution help me to solve the error.
Respondent: MEGHA DOBARIYA

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy