Reputation: 1
In this case, my xml file shows a certain layout while at runtime another one is generated. I am incredibly confused as to why the layout shown at runtime is completely different from the one given. here is the code for the xml file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
</LinearLayout>
<Button
android:id="@+id/signUp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign up!" />
</LinearLayout>
This displays Insert name here on both a label and button. The button is correctly bound and pressing it does do something, however I cannot type in the textfield at runtime.
Upvotes: 0
Views: 175
Reputation: 6108
Try to use this one instead. I have removed the useless LinearLayout and try to make the EditText clickable.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/signUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Sign up!" />
</LinearLayout>
Upvotes: 0
Reputation: 1989
This one looks fine. Double check if you are changing any property with your java code.
Upvotes: 1