1.可能是输入时使用了全角,导致有多余空格。
2.丢失相关布局标签。
3.可能是<?xml version="1.0" encoding="utf-8"?>中未标明utf-8编码。
不过两种可能都看了下,没有出现在我的代码中,最后解决是靠下面的方法:
把鼠标箭头移到出错误的layout上 点击鼠标右键选择Source然后再选Format,再clean一下。
其他参考:
<TextView
android:id="@+id/operation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
/>
改成
<TextView>
android:id="@+id/operation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
</TextView>