[英]No resource found that matches the given name Styles.xml
I am trying to design a new theme for my android application in C# in Xamarin. 我正在尝试为Xamarin中的C#为我的android应用程序设计一个新主题。 I have followed a few tutorials and answers on this but I keep getting the error
我已经遵循了一些教程和答案,但我不断收到错误
No resource found that matches the given name (at 'theme' with value '@android:style/Theme.CustomActionBarTheme')
找不到与给定名称匹配的资源(在“主题”处,值为“ @android:style / Theme.CustomActionBarTheme”)
I have check a few of the relevant answer for this error but none seem to work for me :( 我已经检查了一些有关此错误的答案,但似乎没有一个对我有用:(
Heres my xml code which is located in my Values folder under Resources: Styles.xml 这是我的xml代码,位于我的Values文件夹中的Resources: Styles.xml下
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style
name="AppBaseTheme"
parent="android:Theme.Holo.Light">
</style>
<style
name="CustomActionBarTheme"
parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item
name="android:actionBarStyle">@style/MyActionBar
</item>
</style>
<style
name="MyActionBar"
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item
name="android:background">#033C73
</item>
</style>
</resources>
Can anyone help me out a bit? 谁能帮我一下吗?
Thanks 谢谢
EDIT * So here is the top of my MainActivity.cs 编辑*所以这是我的MainActivity.cs的顶部
[Activity(Label = "My App", MainLauncher = true, Icon = "@drawable/icon", Theme = "@android:style/Theme.CustomerActionBarTheme")] public class MainActivity : Activity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); }
Where is your theme Theme.CustomActionBarTheme ? 您的主题Theme.CustomActionBarTheme在哪里? You call it but it doesn't exist
您称之为它但不存在
Did you make changes in your manifest file 您是否在清单文件中进行过更改
<application
android:theme="@style/CustomActionBarTheme" >
</application>
Now you must be declaring it as 现在,您必须将其声明为
android:theme="@android:style/CustomActionBarTheme" >
Change to: 改成:
[Activity(Label = "My App", MainLauncher = true, Icon = "@drawable/icon", Theme = "@style/Theme.CustomActionBarTheme")]
public class MainActivity : Activity
... ...
You have misspelled your theme name ( CustomerActionBarTheme
instead of CustomActionBarTheme
) and Theme style is declared without the android:
prefix 您拼错了主题名称(
CustomerActionBarTheme
而不是CustomActionBarTheme
),并且声明了主题样式而没有android:
前缀
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.