在android xamarin中创建导航抽屉

时间:2016-09-06 11:07:58

标签: android xml xamarin navigation-drawer

我正在尝试在Android中制作导航抽屉,但我收到此错误:

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>

2 个答案:

答案 0 :(得分:0)

将Xamarin Support v4和v7 AppCompat NuGet包添加到您的项目中。

答案 1 :(得分: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>