Android Studio:呈现问题缺少样式 - 为此布局选择了正确的主题,无法找到具有 id 的样式

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

我想为 CardView 创建卡片项目 xml 布局并收到此错误。 Common solutions here 无效(尝试了所有这些以及类似帖子中的其他人)。

这是我的 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>

这是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>

这是Manifest中的相关部分:

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

这是 gradle build 脚本的相关部分:

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'

这是错误:

谢谢,

我也遇到了同样的问题。请通过选择菜单选项 "File" → "Invalidate Caches / Restart" 重新启动 Android Studio。更多详情请关注link:

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

您可以通过将当前主题更改为合适的主题来解决此问题。每个主题并不适合所有类型的视图。通过使用主题组合框我们可以解决这个问题。
问题来了

1。先去主题栏按一下


2。如下图所示更改主题 现在你改变了你的主题。如果所选主题适合您的视图,它将呈现。

我也遇到了同样的错误,我所做的是将布局主题设置为与我在 manifest.xml 中使用的主题相似并且对我有用。

我遇到了类似的问题,我点击了刷新按钮。

如果问题仍然存在,请尝试使缓存无效并重新启动