0

所以我设置了我的 Eclipse 以拥有 Android SDK 和 ADT 插件。

我将我的 AVD 设置为拥有 Galaxy Nexus 和 Galaxy S2 模拟器。

我创建了一个新的 Android 项目,我得到了我的空白 MainActivity,它只显示“Hello World!” 这就是问题所在。

在图形布局中,我删除了“Hello World!” 文本将其删除。我签入了 activity_main.xml 和包含“Hello World!”的脚本。文字不再存在。我在任一模拟器中运行并且一切正常,但是当应用程序打开时,“Hello World!” 还在那里。

这是现在的xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.project.MainActivity"
tools:ignore="MergeRootFrame" />

除了删除该文本外,我什么都没改变。MainActivity.java 没有被触及。有什么我想念的吗?

4

2 回答 2

1

当它发生在我身上时,这有点奇怪,只需从 fragment.xml 文件中删除 Hello World Text View 就可以了。

于 2014-04-29T14:57:47.747 回答
0

当您在布局上添加 smthg 时,xml 代码仅用于布局,此代码会更大,例如

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
 <Button
        android:id="@+id/bb"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/editText1"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="72dp"
        android:text="git" />

那只有一个按钮你的代码只有布局

于 2014-04-16T19:27:08.010 回答