Xamarin.android 没有找到与给定名称Theme.AppCompat.Light.NoActionBar匹配的资源

Xamarin.android 没有找到与给定名称Theme.AppCompat.Light.NoActionBar匹配的资源,xamarin.android,xamarin-studio,Xamarin.android,Xamarin Studio,我正在Styles.xml文件中添加一些项目。然而,这给了我一个错误 这是我的密码 #2196F3 @样式/我的抽屉行样式 #F5F5F5 真的 错误可以在下面的屏幕截图中看到 检索项的父项时出错:未找到与给定名称“Theme.AppCompat.Light.NoActionBar”匹配的资源 未找到与给定名称匹配的资源:attr“colorPrimary” 未找到与给定名称匹配的资源:attr“DroperarRowStyle”。 4.未找到与给定名称“Widget.AppCompat.

我正在Styles.xml文件中添加一些项目。然而,这给了我一个错误

这是我的密码


#2196F3
@样式/我的抽屉行样式
#F5F5F5
真的
错误可以在下面的屏幕截图中看到

  • 检索项的父项时出错:未找到与给定名称“Theme.AppCompat.Light.NoActionBar”匹配的资源
  • 未找到与给定名称匹配的资源:attr“colorPrimary”
  • 未找到与给定名称匹配的资源:attr“DroperarRowStyle”。 4.未找到与给定名称“Widget.AppCompat.drawerRowToggle”匹配的资源
  • 未找到与给定名称匹配的资源:attr“color”
  • 未找到与给定名称匹配的资源:attr“spinBars”

  • 我不记得是否首先存在
    Theme.AppCompat.Light.NoActionBar

    您可以这样做:

    <style name="MyTheme" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">#2196F3</item>
        <item name="drawerArrowStyle">@style/MyDrawerArrowStyle</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
    </style>
    
    
    #2196F3
    @样式/我的抽屉行样式
    假的
    真的
    
    我通过在xamarin studio android项目包中添加AppCompact v7找到了解决方案


    Link=

    以下是解决这些问题的步骤

  • 转到AndroidManifest.xml并将android:targetSdkVersion添加到usesdk标记下的23
  • 转到Project->General并将目标框架设置为Android 6.0(棉花糖)
  • 进入Project->Android应用程序->将目标Android版本设置为Android 6.0
  • Android 7.0版未在最新的Xamarin Studio中编译。现在您只能编译Android 6.0版本的Android项目。

    添加组件支持库v7 AppCompat
    
    add component Support Library v7 AppCompat 
    
    create values/styles and add
    <?xml version="1.0" encoding="utf-8" ?>
    <resources>
    
      <style name="MyTheme" parent="MyTheme.Base">
      </style>
      <style name="MyTheme.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">#2196F3</item>
        <!-- colorPrimaryDark is used for the status bar -->
        <item name="colorPrimaryDark">#1976D2</item>
        <!-- colorAccent is used as the default value for colorControlActivated
             which is used to tint widgets -->
        <item name="colorAccent">#FF4081</item>
        <!-- You can also set colorControlNormal, colorControlActivated
             colorControlHighlight and colorSwitchThumbNormal. -->
      </style>
    </resources>
    
    add another folder values-v21
    create styles.xml and add
    <?xml version="1.0" encoding="utf-8" ?>
    <resources>
      <!--
            Base application theme for API 21+. This theme replaces
            MyTheme from resources/values/styles.xml on API 21+ devices.
        -->
      <style name="MyTheme" parent="MyTheme.Base">
        <item name="android:windowContentTransitions">true</item>
        <item name="android:windowAllowEnterTransitionOverlap">true</item>
        <item name="android:windowAllowReturnTransitionOverlap">true</item>
        <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
        <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
      </style>
    </resources>
    
    创建值/样式并添加 真的 假的 #2196F3 #1976D2 #FF4081 添加另一个文件夹-v21 创建styles.xml并添加 真的 真的 真的 @android:过渡/移动 @android:过渡/移动
    我认为情况不再如此。对于我下载的项目,没有有效的参考资料。我安装了
    Xamarin.Android.Support.v4
    Xamarin.Android.Support.v7.AppCompat
    以及NuGet商店中的一些其他参考资料。现在应用程序可以编译了。