英文:
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.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="androidx.constraintlayout.widget"> //This one is errorTagged with "Element manifest must be declaired."
<uses-sdk android:minSdkVersion="9" //This one is tagged with "Tag start is not closed" but when I close it with '/>', it changes to 'Unexpected ending.'```
</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>
英文:
<?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>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论