Error:(58) Error parsing XML: not well-formed (invalid token)

使用AndroidStudio,在编辑layout里的视图文件(activity_add_acc.xml)时发生了这个问题,一开始还被它烦恼的好久 .
我的问题:
这里写图片描述
点击报错,跳到的位置是:
这里写图片描述
我这的问题应该是在hint里有写”<”、”>”,所以造成编译错误吧,把他们删了就可以,不过,后面还得在看看有其他方式来写入上面两个符号的。
闲话:在查找问题的过程中,我无意看到下面内容,在一位发帖提问该问题,但自己解决了又不分享方法的SB楼主的评论贴里找到以下方法。方法我在AS上试则是没有的,它们应该主要是用在Eclipse,但可参考下。特地写备着,也给有遇到同样问题的朋友。
1、在xml中检查控件是否缺少开头或结尾,dreawable等文件夹中资源命名是否和系统保留字重复而导致building ,clean无法正常!
2、把鼠标箭头移到出错误的layout上,鼠标右键选择Source然后再选Format ,则可解决
3、举个栗子:

<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>

猜你喜欢

转载自blog.csdn.net/wenghaoduan/article/details/78485008