
安卓xml中着色文本错误
用户遇到了一个问题,想要了解在其xml文件中最后两行文本未能变为红色的原因。
问题诊断
根据提供的图片,问题出在xml代码的着色元素上,具体来说,缺少了一个/结束符。
解决方案
为了解决这个问题,需要在最后一行之后添加一个/符号,如下所示:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是第一行文本" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是第二行文本" />
<font color='red'>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是第三行文本" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是第四行文本" />
</font>/ // 添加结束符
登录后复制
添加了结束符后,xml文件中的最后两行文本将正确着色为红色。
以上就是我的安卓XML文件中的最后两行文本没有变红?的详细内容,更多请关注米云其它相关文章!
