android– 没有XML内容.请在文档中添加根视图或布局

android– 没有XML内容.请在文档中添加根视图或布局,第1张

概述我正在开发一个Android应用程序.我是XML的新手.我收到的消息是“没有XML内容.请在文档中添加视图布局”下面给出了XML代码.请帮忙<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apkes/android"android:layout_wid

我正在开发一个Android应用程序.我是XML的新手.我收到的消息是“没有XML内容.请在文档中添加根视图或布局”下面给出了XML代码.请帮忙

<?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:orIEntation="vertical" >    <TextVIEw        androID:layout_wIDth="fill_parent"        androID:layout_height="wrap_content"        androID:text="@string/ref"         androID:textSize="15dp"/>    <TextVIEw        androID:layout_wIDth="fill_parent"        androID:layout_height="wrap_content"        androID:text="@string/ref2"         androID:textSize="15dp"/>    <EditText        androID:ID="@+ID/uname"        androID:layout_wIDth="150dp"        androID:layout_height="25dp"        androID:inputType="text"        androID:ems="5" >        <requestFocus />    </EditText>   <TextVIEw        androID:layout_wIDth="fill_parent"        androID:layout_height="wrap_content"        androID:text="@string/ref3"         androID:textSize="15dp"/>    <EditText        androID:ID="@+ID/pwd"        androID:layout_wIDth="150dp"        androID:layout_height="25dp"        androID:inputType="text"        androID:ems="5" />    <button        androID:layout_wIDth="60dp"         androID:layout_height="35dp"        androID:text="@string/ref"         androID:ID="@+ID/bLogin" />  </linearLayout>

—-主要活动代码—

package com.androID.disasteralertApp;import androID.app.Activity;import androID.os.Bundle;import androID.Widget.button;public class MainActivity extends Activity {   /** Called when the activity is first created. */   button login;   @OverrIDe   public voID onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentVIEw(R.layout.main);    login =(button) findVIEwByID(R.ID.bLogin);   }}----Manifest----[2012-04-17 00:34:20 - disaster Alert App] res\layout\main.xml:0: error: Resource entry      main is already defined.[2012-04-17 00:34:20 - disaster Alert App] res\layout\main.out.xml:0: Originally defined here.[2012-04-17 00:34:20 - disaster Alert App] C:\Users\Acer\workspace\disaster Alert App\res\layout\main.out.xml:1: error: Error parsing XML: no element found[2012-04-17 01:05:59 - disaster Alert App] res\layout\main.xml:0: error: Resource entry main is already defined.[2012-04-17 01:05:59 - disaster Alert App] res\layout\main.out.xml:0: Originally defined here.[2012-04-17 01:05:59 - disaster Alert App] C:\Users\Acer\workspace\disaster Alert App\res\layout\main.out.xml:1: error: Error parsing XML: no element found[2012-04-17 01:11:14 - disaster Alert App] res\layout\main.xml:0: error: Resource entry main is already defined.[2012-04-17 01:11:14 - disaster Alert App] res\layout\main.out.xml:0: Originally defined here.[2012-04-17 01:11:14 - disaster Alert App] C:\Users\Acer\workspace\disaster Alert App\res\layout\main.out.xml:1: error: Error parsing XML: no element found[2012-04-17 01:14:56 - disaster Alert App] ------------------------------[2012-04-17 01:14:56 - disaster Alert App] AndroID Launch![2012-04-17 01:14:56 - disaster Alert App] Connection with adb was interrupted.[2012-04-17 01:14:56 - disaster Alert App] 0 attempts have been made to reconnect.[2012-04-17 01:14:56 - disaster Alert App] You may want to manually restart adb from the Devices vIEw.[2012-04-17 01:17:27 - disaster Alert App] Error in an XML file: aborting build.[2012-04-17 01:37:10 - disaster Alert App] res\layout\main.xml:0: error: Resource entry main is already defined.[2012-04-17 01:38:42 - disaster Alert App] res\layout\main.xml:0: error: Resource entry main is already defined.[2012-04-17 01:38:42 - disaster Alert App] res\layout\main.out.out.xml:0: Originally defined here.[2012-04-17 01:38:42 - disaster Alert App] C:\Users\Acer\workspace\disaster Alert App\res\layout\main.out.out.xml:1: error: Error parsing XML: no element found[2012-04-17 01:39:28 - disaster Alert App] Error in an XML file: aborting build.

解决方法:

哦 – 看到’main.out.xml’?当你用eclipse启动XML文件时会发生什么.只需删除’out’xml并保留main.xml

当你点击Play时,一定要选择/编辑.java文件,否则eclipse会产生’out.xml’而无法启动.

总结

以上是内存溢出为你收集整理的android – 没有XML内容.请在文档中添加根视图或布局全部内容,希望文章能够帮你解决android – 没有XML内容.请在文档中添加根视图或布局所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1119706.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存