Skip to content

Resource naming conventions

João Silva edited this page Mar 31, 2020 · 1 revision

The app resources should follow naming conventions so that code written from everyone is coherent.

The notation can be explained as follows:

<WHAT> - Indicates what the resource actually represents, often a standard Android view class. (e.g activity)

<WHERE> - Indicates where the resource belongs. Usually refers to a layout name. Resources used in multiple screens use all. (e.g main)

<DESCRIPTION> - Used to describe the resource. Typically app specific. (e.g title)

<SIZE> - The size of the resource, used in dimensions and drawables. (e.g 24)

Layouts

<WHAT>_<WHERE>

e.g : activity_main, fragment_course_details

Strings

<DESCRIPTION>_<WHERE>

e.g : title_home, hint_search

Drawables

<WHAT>_<DESCRIPTION>_<SIZE>

e.g : ic_search_white_24, ic_heart_24

IDs

<WHAT>_<WHERE>_<DESCRIPTION>

e.g : textview_home_title, button_home_search

Dimensions

<WHERE>_<DESCRIPTION>_<SIZE>

e.g : fragments_padding_20

Clone this wiki locally