

hint: hint is an attribute used to set the hint i.e. EditText editText = (EditText)findViewById(R.id.simpleEditText) ĮtText("Username") //set the text in edit textĤ. īelow is the example code in which we set the text in a text view programmatically means in java class. We can set the text in xml as well as in the java class.īelow is the example code in which we set the text “Username” in a edit text. text: text attribute is used to set the text in a EditText. gravity: The gravity attribute is an optional attribute which is used to control the alignment of the text like left, right, center, top, bottom, center_vertical, center_horizontal etc.īelow is the example code with explanation included in which we set the right gravity for text of a EditText. Below is the example code in which we set the id of a edit text. id: id is an attribute used to uniquely identify a text EditText.
