草庐IT

android - 解析 XML 时出错 : junk after document element;The markup in the document following the root element must be well- formed

coder 2024-07-02 原文

我收到这个错误:

在此行发现多个注释:- 文档中跟在根元素之后的标记必须格式正确。 - 错误:解析 XML 时出错:文档元素后出现垃圾

这出现在

的开头
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
    parent="@style/Theme.Holo">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
    <item name="android:actionMenuTextColor">@color/actionbar_text</item>
</style>

<!-- ActionBar title text -->
<style name="MyActionBarTitleText"
    parent="@style/TextAppearane.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/actionbar_text</item>
</style>

<!-- ActionBar tabs text styles -->
<style name="MyActionBarTabText"
    parent="@style/Widget.Holo.ActionBar.TabText">
    <item name="android:textColor">@color/actionbar_text</item>
</style>

我接受任何帮助!!

最佳答案

尝试这种方式,希望这能帮助您解决问题。

问题是:您在样式的第一行忘记了 xmls 模式。

<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
        parent="@style/Theme.Holo">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
        <item name="android:actionMenuTextColor">@color/actionbar_text</item>
    </style>

    <!-- ActionBar title text -->
    <style name="MyActionBarTitleText"
        parent="@style/TextAppearane.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">@color/actionbar_text</item>
    </style>

    <!-- ActionBar tabs text styles -->
    <style name="MyActionBarTabText"
        parent="@style/Widget.Holo.ActionBar.TabText">
        <item name="android:textColor">@color/actionbar_text</item>
    </style>
</resources>

关于android - 解析 XML 时出错 : junk after document element;The markup in the document following the root element must be well- formed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25235033/

有关android - 解析 XML 时出错 : junk after document element;The markup in the document following the root element must be well- formed的更多相关文章

随机推荐