Android Studio:呈现问题缺少为此布局选择的样式正确的主题,无法找到ID为的样式 [英] Android Studio: Rendering Problems Missing styles-correct theme chosen for this layout, Failed to find style with id

查看:241
本文介绍了Android Studio:呈现问题缺少为此布局选择的样式正确的主题,无法找到ID为的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为CardView创建卡片项目xml布局并得到此错误. 此处的常见解决方案不起作用(尝试过全部以及其他类似帖子中的内容).

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).

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

这是错误:

谢谢

推荐答案

我也遇到了同样的问题.请通过选择菜单选项文件"→使缓存无效/重新启动"来重新启动Android Studio.有关更多详细信息,请单击链接:

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

这篇关于Android Studio:呈现问题缺少为此布局选择的样式正确的主题,无法找到ID为的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆