简体   繁体   English

找不到资源样式,即使我已经将其删除并且未在 Styles.xml 中使用

[英]Resource style not found even though I already remove it and not using in Styles.xml

I created this in Styles.xml我在 Styles.xml 创建了这个

<style name="Content.Right">
    <item name="android:paddingTop">60dp</item>
    <item name="android:paddingLeft">20dp</item>
    <item name="android:paddingRight">20dp</item>
    <item name="android:paddingBottom">20dp</item>
    <item name="android:background">@drawable/bg_round_corner_top_right</item>
    <item name="android:backgroundTint">@color/white</item>
</style>

Then, suddenly I removed this style because I will not using it anymore, but an error occur.然后,突然我删除了这个样式,因为我不会再使用它了,但是发生了错误。

错误信息

I already try to clean and rebuild the project, and reopen the Visual Studio but this error still occur.我已经尝试清理并重建项目,并重新打开 Visual Studio,但仍然出现此错误。 Also there is no file that open when I click the error.当我点击错误时也没有打开的文件。

Additionally, after remaining the style another error occur此外,保留样式后会发生另一个错误

在此处输入图像描述

So I added another style in Style.xml to fix the error.所以我在 Style.xml 中添加了另一种样式来修复错误。

在此处输入图像描述

Why this error occur and what is the way to fix this?为什么会发生此错误以及解决此问题的方法是什么?

Other information:其他信息:

  • Microsoft Visual Studio Enterprise 2022 Version 17.1.4 Microsoft Visual Studio Enterprise 2022 版本 17.1.4
  • Xamarin.android project Xamarin.android项目
  • Android 12 framework Android 12 框架
  • Windows 10 Windows 10

I was able to reproduce this issue.我能够重现这个问题。 在此处输入图像描述

Change:改变:

<style name="Content.Right">
    <item name="android:paddingTop">60dp</item>
    <item name="android:paddingLeft">20dp</item>
    <item name="android:paddingRight">20dp</item>
    <item name="android:paddingBottom">20dp</item>
    ....
</style>

To:到:

<style name="Content_Right">
    <item name="android:paddingTop">60dp</item>
    <item name="android:paddingLeft">20dp</item>
    <item name="android:paddingRight">20dp</item>
    <item name="android:paddingBottom">20dp</item>
   ...
</style>

You could refer to Naming Practices below for xml: xml可以参考下面的命名规范:

  • Avoid "-".避免 ”-”。 If you name something "first-name", some software may think you want to subtract "name" from "first".如果您将某物命名为“first-name”,某些软件可能会认为您想从“first”中减去“name”。
  • Avoid ".".避免 ”。”。 If you name something "first.name", some software may think that "name" is a property of the object "first".如果您将某物命名为“first.name”,某些软件可能会认为“name”是 object“first”的属性。
  • Avoid ":".避免 ”:”。 Colons are reserved for namespaces (more later).冒号是为命名空间保留的(稍后会详细介绍)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VS 2019 错误样式属性styles.xml 未找到 - VS 2019 Error style attribute styles.xml not found 为什么我会收到包含 pch.h 的警告,即使它已经包含在内? - Why am I getting a warning to include pch.h even though it's already included? GetFileLineNumber()返回0,即使我正在使用调试版本 - GetFileLineNumber() returns 0, even though I'm using a debug build 即使我使用完全限定的名称,也收到了模棱两可的引用错误 - I am getting an ambiguous reference error even though I am using fully qualified name NuGet 包管理器:即使包存在,“未找到包” - NuGet Package Manager: “No packages found” even though the package exists opencv:无法在“”中加载 Qt 平台插件“xcb”,即使它已找到 - opencv: Could not load the Qt platform plugin "xcb" in "" even though it was found Xamarin Android:资源android:找不到样式/AppTheme.Base - Xamarin Android: Resource android: style/AppTheme.Base Not Found Visual Studio无法在WPF窗口中解析静态资源,即使它在运行时也可以运行 - 为什么? - Visual Studio can't resolve static resource in WPF window, even though it works at run time - why? 在C#中使用Cloo时,即使我安装了图形卡,ComputePlatform.Platforms.Count也为零(显然) - When using Cloo in C#, ComputePlatform.Platforms.Count is zero, even though I have a graphics card installed (obviously) MS Word 在后台运行并请求保存文档,即使它已经保存 - MS Word runs on background and requests documents to be saved even though it is already saved
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM