I am studying Android application development with XML in Android Studio at an educational institution. I saw a code like this:
<EditText
android:id=”@ id/MU_EditText_id”
android:layout_width="match_parent"
android:layout_height="wrap-content"
android:hint="Please login e-mail adress"
android:textSize="15px"
android:inputType="textEmailAdress"
android:maxLines="1"
/>
The android:id
part caught my attention. Why is this id so long? Couldn't there be a simpler use? Thanks in advance for your valuable information.
CodePudding user response:
The id can be as long or as short as you like it to be. android:id=”@ id/
is necessary, but everything after that is the id that your ui element is referenced by and is up to you to name. The id could also just be a character, but the best practice is to name your ids corresponding to what they are or what they are used for.