在世界你好XML错误 [英] errors in hello world xml

查看:413
本文介绍了在世界你好XML错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的android开发和正在看书吧(开始的Andr​​oid 4.0开发),并同时创造世界你好我被困在几个误区,首先,我解决了他们,但我的应用程序被强制关闭,所以我复制粘贴的所有事情并得到了4个错误: -

i am new to android development and was reading a book for it (beginning android 4 development) and while creating hello world i got stuck in few errors, first i solved them but my app was force closing so i copy pasted all thing and got 4 errors :-

在该行找到多个注释:
       - 属性丢失了Android命名空间preFIX
       - 可疑的命名空间:应该以http://
       - 打开报价预计为属性的xmlns:机器人与元素类型​​的LinearLayout有关。
       - 错误:错误的解析XML:没有很好地形成(无效标记)

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:android" associated with an element type "LinearLayout". - error: Error parsing XML: not well-formed (invalid token)

意外的命名空间preFIX机器人找到的标记的TextView

Unexpected namespace prefix "android" found for tag TextView

在该行找到多个注释:
       - 意外的命名空间preFIX机器人找到标签的TextView
       - 属性丢失了Android命名空间preFIX

Multiple annotations found at this line: - Unexpected namespace prefix "android" found for tag TextView - Attribute is missing the Android namespace prefix

意外的命名空间preFIX机器人找到的标记按钮

Unexpected namespace prefix "android" found for tag Button

code样品

<?xml version ="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_orientation="vertical"

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" />

 <TextView
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:text="@string/This is my first Android Application!" />

 <Button
     android:layout_width="fill_parent"
     android:layout_width="wrap_content"
     android:text="@string/And this is clickable :D" />

我不认为有一个在code任何错误:/

i dont think there's any mistake in code :/

推荐答案

替换code的每一个符合的报价和使用CTR +筛选+ f和保存文件。

Replace the quotes of every line of code with " and use ctr+sift+f and save the file.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" />

 <TextView
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:text="@string/This is my first Android Application!" />

 <Button
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:text="@string/And this is clickable :D" />

</LinearLayout>

这篇关于在世界你好XML错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆