0

eclipse ADT を使用して非常に単純な Android デモを実行しようとしています。アプリがコンパイルされ、エミュレーターが開きますが、コントロールが表示されません。アプリのタイトルがありますが、ボタンとテキスト フィールドが表示されません。何か案は?コンソールにエラーは表示されません。

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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: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" 
        android:onClick="sendMessage"/>
</LinearLayout>
4

1 に答える 1

0

setContentView (R.layout.yourLayout);このメソッドを呼び出す必要があります。これにより、レイアウト ファイルが拡張され、Activity 内に表示できるようになります。

于 2012-12-07T21:13:16.270 に答える