![](/img/trans.png)
[英]No resource found that matches the given name, where I do something wrong?
[英]No resource found that matches the given names
我將構建一個Xamarin應用程序但是當我開始構建Android項目時,編譯器給出了9個錯誤:
9個錯誤:找不到與給定名稱匹配的資源:
attr windowNoTitle
attr colorPrimaryDark
attr windowActionBar
attr windowActionModeOverlay
attr colorAccent
attr colorPrimary
attr colorAccent
Theme.AppCompat.Light.Dialog
Theme.AppCompat.Light.DarkActionBar
注意:錯誤發生在Project.Droid
項目的文件styles.xml
中。
在這里你可以找到styles.xml
文件:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#2196F3</item>
<item name="colorPrimaryDark">#1976D2</item>
<item name="colorAccent">#FF4081</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>
我在SmartBox.Droid
項目中沒有任何改變,但是出現了這個錯誤。 問題是否發生是因為我在SmartBox (Portable)
項目中添加了MainPage.xaml
和Map.xaml
? 我需要兩頁,因為我將在兩頁之間導航。
我在谷歌和搜索引擎優化的各個地方都進行了搜索,但沒有找到能幫助我的解 我可以在GitHub( https://github.com/HeinPauwelyn/SmartBox )的文件夾Execution→SmartBox中找到我的源代碼
請試試這個解決方案:
將您的Xamarin更新到最新版本(共享項目和您的平台項目)。
然后重定向到C:\\Users\\<username>\\AppData\\Local\\
並將Xamarin
文件夾重命名為Xamarin_old
。
重新打開您的項目,然后構建它。 完全下載軟件包需要幾分鍾。
嘗試在Resources / Layout文件夾中的Tabbar.axml
和Toolbar.axml
編輯以下行。 這對我有用。
Tabbar.axml
從:
android:background="@style/colorPrimary"
app:tabIndicatorColor="@color/white"
至:
android:background="?attr/colorPrimary"
app:tabIndicatorColor="@android:color/white"
Toolbar.axml
從:
android:background="@style/colorPrimary"
至:
android:background="?attr/colorPrimary"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.