<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="非常简陋,莫嫌弃>_<"
android:textColor="#75919f"
android:lineSpacingExtra="10dp"/>
报错信息为:Error:(30) Error parsing XML: not well-formed (invalid token),紧接着我所有的R文件失效,项目全面飘红,吓屎我噜。好在有强大的度娘助我解决,哈哈哈。不过其实AS本身也提示了错误信息,就看你自己有没有注意罢了。
我勒个去,原来是TextView中的 >_< 出了错误。要使用转义字符,emmmm…..
在values包下的strings.xml文件中写上
<string name="shuoming">非常简陋,莫嫌弃>_<</string>
然后布局文件中引用
android:text="@string/shuoming"
就此大功告成了。
再多说一句,一般R文件失效,clean项目也不起作用,多半是xml文件出了错误,好好仔细排查解决即可