hello world xml中的java错误
我是安卓开发新手,正在读一本关于它的书(开始安卓 4开发),在创建hello world时,我遇到了一些错误,首先我解决了它们,但我的应用程序被强制关闭,所以我复制粘贴了所有内容,并出现了4个错误:-
Multiple annotations found at this line: - Attribute is missing the Android namespace prefix - Suspicious namespace: should start with http:// - Open quote is expected for attribute "xmlns:安卓" associated with an element type "LinearLayout". - error: Error parsing XML: not well-formed (invalid token)
Unexpected namespace prefix "安卓" found for tag TextView
Multiple annotations found at this line: - Unexpected namespace prefix "安卓" found for tag TextView - Attribute is missing the Android namespace prefix
Unexpected namespace prefix "安卓" found for tag Button
代码示例
<?xml version ="1.0" encoding="utf-8"?>
<LinearLayout xmlns:安卓=”http://schemas.安卓.com/apk/res/ 安卓”
安卓:layout_width="fill_parent"
安卓:layout_height="fill_parent"
安卓:layout_orientation="vertical"
<TextView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:text="@string/hello" />
<TextView
安卓:layout_width=”fill_parent”
安卓:layout_height=”wrap_content”
安卓:text=”@string/This is my first Android Application!” />
<Button
安卓:layout_width="fill_parent"
安卓:layout_width="wrap_content"
安卓:text="@string/And this is clickable :D" />
我认为代码中没有任何错误:/
# 1 楼答案
将xml中的“替换为”以使其成为有效的xml
# 2 楼答案
这是一个复制粘贴问题。将第2行中的引号替换为“应该有效”