Android EditText Control

Android EditText Control

Android EditText is a text view, which can be edited. It is a subclass of TextView.


Use Android EditText Control for entering values from user, such as, Name, search box etc. Under EditText, you can also mention a text that gives user a hint, for example, Enter Name, Enter Age, etc.


Now, we will write the code xml file.

Follow the below code,


For src\main\res\layout\activity_main.xml,
The src\main\java\com\studyopedia\studyopediaapplication\ is a java class which sets the views. Here we will set the View to be displayed with the setContentView. Through this, Set the main layout as your main content view,


The content of \src\main\AndroidManifest.xml, provides key information of your app to the system. The system needs this to run your code,


Here’s the code for res/values/strings.xml. The app name and any hardcoded string will be visible,


It shows our EditText, which asks user to enter the name.

We will also see how it looks when the value is added to the EditText i.e. name,

Android EditText Output

Now, enter the name under EditText control,

Android EditText Output

Padding in Android Layout
Android TextView Control
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create free tutorials for all.

No Comments

Post A Comment