2016-09-06 141 views
0

我試圖做一個抽屜式導航android的,但我得到這個錯誤創建抽屜式導航:android系統xamarin

1.No resource found that matches the given name: attr 'colorPrimary'. 
2.No resource found that matches the given name: attr 'colorPrimaryDark'. 
3.No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar' 

,這裏是我的代碼

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="Theme.DesignDemo" parent="Base.Theme.DesignDemo"></style> 
    <style name="Base.Theme.DesignDemo" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="colorPrimary">#2196F3</item> 
    <item name="colorPrimaryDark">#1976D2</item> 
    </style> 
</resources> 
+0

好像你還沒有加入支持庫到項目 –

+0

,但我做到了! –

回答

0

添加Xamarin支持V4和V7 AppCompat NuGet包到您的項目。

+0

我這樣做第一 –

0

試試這個:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="Theme.DesignDemo" parent="Base.Theme.DesignDemo"></style> 
    <style name="Base.Theme.DesignDemo" parent="@android:style/Theme.AppCompat.Light.NoActionBar"> 
    <item name="android:colorPrimary">#2196F3</item> 
    <item name="android:colorPrimaryDark">#1976D2</item> 
    </style> 
</resources> 
+0

與此代碼2的錯誤消失 –

+0

但沒有資源發現匹配給定的名稱'Theme.AppCompat.Light.NoActionBar'仍然抵抗 –

+0

添加此[組件](https://components.xamarin。 com/view/xamandroidsupportv7appcompat) –