0

そこで、Android SDK と ADT プラグインを使用するように Eclipse をセットアップしました。

AVD を設定して、Galaxy Nexus と Galaxy S2 エミュレーターを用意しました。

新しい Android プロジェクトを作成し、「Hello World!」と表示される空の MainActivity を取得しました。これが問題です。

グラフィカル レイアウトで、「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

これは私に起こったときは少し奇妙でした.Hello World Text Viewをfragment.xmlファイルから削除するだけで問題ありません.

于 2014-04-29T14:57:47.747 に答える
0

そのxmlコードは、レイアウトにsmthgを追加するとレイアウト用です。このコードは大きくなります。例

<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 に答える