我如何修复我的colors.xml文件中的错误?

huangapple go评论78阅读模式
英文:

How can I fix errors in my colors.xml file?

问题

我是 Android 编程新手,正在使用版本 3.6.3。我遇到了一个构建失败的错误 1;XML 文档必须以相同的实体开始和结束。

```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="androidx.constraintlayout.widget"> // 这一行出现错误,标记为“必须声明 manifest 元素。”

    <uses-sdk android:minSdkVersion="9" // 这一行标记为“标记未关闭”,但当我使用 '/>' 来闭合时,错误变为“意外结尾。”
英文:

I am new to Android programming and running on version 3.6.3. I am having a Build failed: error 1; XML document must start and end with the same entity.

&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; package=&quot;androidx.constraintlayout.widget&quot;&gt; //This one is errorTagged with &quot;Element manifest must be declaired.&quot;

    &lt;uses-sdk android:minSdkVersion=&quot;9&quot; //This one is tagged with &quot;Tag start is not closed&quot; but when I close it with &#39;/&gt;&#39;, it changes to &#39;Unexpected ending.&#39;```

</details>


# 答案1
**得分**: 2

```xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
    <color name="colorPrimary">#008577</color>
    <color name="colorPrimaryDark">#ff0000</color>
    <color name="colorAccent">#00ff00</color>
    <color name="mtrl_textinput_default_box_stroke_color" tools:override="true">#000</color>
</resources>
英文:
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;resources xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;
    &lt;color name=&quot;colorPrimary&quot;&gt;#008577&lt;/color&gt;
    &lt;color name=&quot;colorPrimaryDark&quot;&gt;#ff0000&lt;/color&gt;
    &lt;color name=&quot;colorAccent&quot;&gt;#00ff00&lt;/color&gt;
    &lt;color name=&quot;mtrl_textinput_default_box_stroke_color&quot; tools:override=&quot;true&quot;&gt;#000&lt;/color&gt;
&lt;/resources&gt;

huangapple
  • 本文由 发表于 2020年5月5日 15:56:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/61608349.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定