问题描述
我想按照这个教程:因为我是新来开发Android,这是我的activity_main.xml中文件看起来是这样的:
I am trying to follow this tutorial : http://developer.android.com/training/basics/firstapp/building-ui.html as I am new to android developing and this is what my "activity_main.xml" file looks like :
<?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="horizontal">
<EditText android:id="@+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send" />
当我点击运行,我得到一个错误,指出没有XML内容,请添加到您的文档根视图或布局。我注意到有一个名为activity_main.out.xml生成一个新文件。什么可能我是做错了?
When I click run I get an error that says "No XML content. Please add a root view or layout to your document." and I noticed there is a new file generated called "activity_main.out.xml". What could I be doing wrong?
推荐答案
Eclipse正在运行XML不是你的活动。如果previous解决方案不工作,然后删除 actvity_main_out.xml
和运行应用程序不是XML。
Eclipse is running the XML not your activity. If previous solution doesn't work then delete actvity_main_out.xml
and run the app not XML.
这篇关于[否XML内容。请根视图或布局添加到您的文档&QUOT。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!