I’m trying to run a very simple Android demo using the eclipse ADT. The app compiles & the emulator opens but no controls show up. I have a title for the app, but the button & text field do not display. Any ideas? I don’t see any errors in the console.
<?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>
You need to call
setContentView (R.layout.yourLayout);This method inflates your layout file and allows it to be displayed within your Activity.