![](/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.