编辑style.xml时,“Prolog中不允许使用内容”

时间:2016-03-04 10:53:22

标签: android

我正在编辑style.xml

当我保存时,出现了这个错误:

  

Prolog

中不允许使用内容

我知道这个问题已经被问到了。 但那里的解决方案没有用。

这是我的style.xml文件:

?xml version="1.0" encoding="utf-8"?>  <The error occur here>
<resources>
<style name="apptheme" parent="@android:Theme.DeviceDefault.Light">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textColor">#00FF00</item>
    <item name="android:typeface">monospace</item>
</style>
</resources>

1 个答案:

答案 0 :(得分:4)

你错过了一个开头“&lt;”

<?xml version="1.0" encoding="utf-8"?> 
<resources>
    <style name="apptheme" parent="@android:Theme.DeviceDefault.Light">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">#00FF00</item>
        <item name="android:typeface">monospace</item>
    </style>
</resources>

您需要在文件开头的“<”之前添加“?”。

相关问题