![](/img/trans.png)
[英]No resource found that matches the given name in common_signin_btn_icon_dark.xml
[英]No resource found that matches the given name Styles.xml
我正在尝试为Xamarin中的C#为我的android应用程序设计一个新主题。 我已经遵循了一些教程和答案,但我不断收到错误
找不到与给定名称匹配的资源(在“主题”处,值为“ @android:style / Theme.CustomActionBarTheme”)
我已经检查了一些有关此错误的答案,但似乎没有一个对我有用:(
这是我的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>
谁能帮我一下吗?
谢谢
编辑*所以这是我的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); }
您的主题Theme.CustomActionBarTheme在哪里? 您称之为它但不存在
您是否在清单文件中进行过更改
<application
android:theme="@style/CustomActionBarTheme" >
</application>
现在,您必须将其声明为
android:theme="@android:style/CustomActionBarTheme" >
改成:
[Activity(Label = "My App", MainLauncher = true, Icon = "@drawable/icon", Theme = "@style/Theme.CustomActionBarTheme")]
public class MainActivity : Activity
...
您拼错了主题名称( CustomerActionBarTheme
而不是CustomActionBarTheme
),并且声明了主题样式而没有android:
前缀
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.