Android见招拆招五:XML匹配问题、XML资源引用的必要性

The processing instruction target matching "[xX][mM][lL]" is not allowed.

问题描述

原因及解决方法

XML第一行没有写而直接写了第二行,XML前面空行或者有空格都会导致匹配错误。

[I18N] Hardcoded string "3", should use @string resource

问题描述

原因及解决方法

android:text="123313"

直接写也能正常显示,但是会出现警告提示用@string引用

引用的优势在于可以做到一改全改,在支持多语言时也是很有用的。

另外,颜色的设置也最好在color.xm中类似设置。

正确的用法

android:text="@string/123313"

并在strings.xml中声明

<string name="123313">测试方块33</string>
原文地址:https://www.cnblogs.com/gaozy/p/3862160.html