我的activity_main.xml文件如下所示:
<?xml version=”1.0” encoding=”utf-8”?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:orientation=”vertical” >
<TextView
android:id=”@+id/mytext”
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”@string/hello” />
</LinearLayout>
我应该如何修复这个错误?
最佳答案
在我看来,您好像粘贴了 Word 或类似内容中的一些文本,这意味着您有“弯引号”。所以您的 XML 声明如下所示:
<?xml version=”1.0” encoding=”utf-8” ?>
当它应该是这样的时候:
<?xml version="1.0" encoding="utf-8" ?>
请注意引号中的差异。您应该将所有引号修复为常规 ASCII 引号...并且理想情况下不要使用您所遵循的任何过程来复制和粘贴文本从一个地方到另一个地方...这显然对 XML 不友好或任何其他依赖于常规引号的内容。
关于java - XML声明中的以下 "version"必须是带引号的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27087342/