You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
id should contain the prefix of the layout in which it exists. For example, inside the layout activity_auth.xml all ids of controls will start with activity_auth;
id should contain clear description of the control and what it does. Like connect_options, user_name etc.;
each id should have a suffix which defines the type of the control. For example, btn for the Button (like activity_auth_connect_btn).
Like in any framework some controls become deprecated, another controls are introduced. That's why there is a sense to define the following basic suffixes for the controls:
btn - button control (Button, RadioButton, ImageButton, CheckBox, custom button)
txt - TextView control
input - EditText or any input related control
list - for list control (ListView, GridView, RecyclerView)
selector / spinner - for Spinner control
I use such naming rules for a while and think they are quite convenient. They give an opportunity not to intersect ids between different layout. Also it's much easier to find related control by id inside the layout.
Please include some best practices about naming conventions for
android:id
of components in XML layouts.The text was updated successfully, but these errors were encountered: