2015-11-04 31 views
0

我試圖在我的佈局中插入卡片視圖,但它給出了此渲染錯誤。無法構建卡片視圖

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 with id 0x7fff001a in current theme. 

我已經列入本在應用程序的gradle產出:

  • 編譯 'com.android.support:cardview-v7:23.1.0'

此外,我在款式中使用的主題是

  • Theme.AppCompat.Light.NoActionBar

的styles.xml是在這裏:

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="colorPrimary">@color/primaryColor</item> 
    <item name="colorPrimaryDark">@color/primaryColorDark</item> 
    <item name="colorAccent">@color/accentColor</item> 
    <item name="cardStyle">@style/CardView.Light</item> 
</style> 

的cardview是在這裏:關於風格

<android.support.v7.widget.CardView 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    app:cardCornerRadius="4dp" 
    app:elevation="5dp"/> 

錯誤消息會談ID 0x7fff001a。它指的是什麼?

+0

您是否爲活動和清單文件設置了主題? – Eoin

回答

0

嘗試到Gradle CleanRebuildSync all Gradle files。這restart Android的工作室後,轉至:

enter image description here

當您創建的風格不正確或從現有樣式,出現這種問題一般。所以選擇「圖形佈局」選擇「AppTheme」 - >與藍星的標籤。並選擇任何預定義的樣式。在我的情況下,應該解決問題的「光」。

如果問題仍然存在,只是暫時從您的主題中刪除<item name="cardStyle">@style/CardView.Light</item>並試一試。

+0

謝謝Anoop ..工作..非常感謝...而且我在這裏拉我的頭髮:D:D –