检索项目的父项时出错:找不到与给定名称“Theme.AppCompat.Light.DarkActionBar”匹配的资源。视觉工作室xamarin

时间:2017-02-13 06:23:47

标签: android xamarin.android

它给了我9个style.xml错误,上面写着

  

检索项目的父项时出错:找不到与之匹配的资源   名称'Theme.AppCompat.Light.DarkActionBar'错误没有资源   发现匹配给定的名称:attr'windowNoTitle'。

像我正在使用带有xamarin的visual studio

    <?xml version="1.0" encoding="utf-8" ?>
<resources>

  <style name="Theme.Splash" parent="android:Theme">
    <item name="android:windowBackground">@drawable/splashscreen</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowActionBar">false</item>
  </style>

  <style name="MainTheme" parent="MainTheme.Base">
  </style>
  <!-- Base theme applied no matter what API -->
  <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
    <item name="windowNoTitle">true</item>
    <!--We will be using the toolbar so no need to show ActionBar-->
    <item name="windowActionBar">false</item>
    <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">#a84849</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">#444</item>
    <!-- colorAccent is used as the default value for colorControlActivated
         which is used to tint widgets -->
    <item name="colorAccent">#a84849</item>
    <!-- You can also set colorControlNormal, colorControlActivated
         colorControlHighlight and colorSwitchThumbNormal. -->
    <item name="windowActionModeOverlay">true</item>

    <!--<item name="datePickerDialogTheme">@style/AppCompatDialogStyle</item>-->
  </style>

  <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">#A84849</item>
  </style>
</resources>

2 个答案:

答案 0 :(得分:2)

您可能不会引用android support v7 AppCompat库。它将显示如下错误。

enter image description here

请添加支持v7 AppCompat库表单nuget:

enter image description here

你将建立成功: enter image description here

答案 1 :(得分:0)

正确的解决方案&gt;清洁。然后重新建立。

您也可以关闭并重新打开VS,这有助于解决那些奇怪的“找不到资源”错误。

还尝试添加'android:windowNoTitle'而不仅仅是'windowNoTitle'