How to Add an EditText to an Activity

1. Create an Android project, if you don't already have one.

2. Open the activity_main.xml file and add the below highlighted code to add an EditText to the XML file before the </LinearLayout> tag.

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

3. Compile and run!

Next Recommended Article: android:text - Display Text in a TextView/EditText

Resources: