If you open an app like gmail, and you compose a new email in the To and Subject lines, it says To and Subject in the respective EditText
's. How do you add a title like that to an EditText
? Are those custom views? Or is it possible to do that with the default widget?
Thanks.
In android, we can set the text of EditText control either while declaring it in Layout file or by using setText() method in Activity file.
EditText is used for user input. TextView is used to display text and is not editable by the user. TextView can be updated programatically at any time.
Edittext is one of many such widgets which can be used to retrieve text data from user. Edittext refers to the widget that displays an empty textfield in which a user can enter the required text and this text is further used inside our application. Class Syntax: public class EditText extends TextView.
It is called a hint
.
Set your hint programatically or use it as xml attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With