Android resource naming specification sharing

  • 2020-05-17 06:24:20
  • OfStack

Android resource naming specification
In recent months, a lot of work has been done on android resources. For complex applications, a specification of resource naming is necessary. In addition to developers, UI designers (or those involved in cutting diagrams) also need to be very clear about where resources are being used so that communication is straightforward. The disadvantage is that the resource has a longer name, but in terms of overall value, it's worth it.
The named template is: abbreviation _ main interface _ function section
(1) abbreviation:
ic ----------------------icon
bg---------------------background
di----------------------divider
sl-----------------------selector
cl-----------------------color
bt----------------------button
ic is mainly used in app ICONS
bg is primarily used for layout and sublayout backgrounds
di is mainly used for dividing lines, including not only divider in Listview, but also lines in normal layout
sl is mainly used in various states of a certain 1view, including not only selector in Listview, but also selector for buttons
cl is mainly used for color values
bt is mainly used for the presentation of buttons, sometimes we hesitate between ic and bt. The simple distinction is the function view. If an view performs the functions of back or confirm or cancel, then bt should be used for naming
(2) main interface:
The main function page, app main Activity. For Browser, for example, BrowserActivity, BookmarkActivity, SettingActivity, AboutActivity.
(3) function:
That is, the functional area corresponding to each main interface. Taking BrowserActivity as an example, it contains the following functional parts: 1, titlebar, 2, speedial 3, toolbar, 4, menu, etc
It should be noted here that the division of functions is based on the content characteristics displayed in a particular interface. For example, although menu is controlled by toolbar, it is not subdivided under toolbar.
(4) the suffix
unit -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - when using xml tilemode to match images, element images using this suffix
nor-- the state of the picture, representing the normal state
hl-- the state of the picture, which represents the highlighted state
press-- the state of the picture represents the state of the press
select-- the status of the image, which represents the view selected
unselect-- the status of the image, representing the percentage of view not selected
(5) other
1. Relative status for functions, such as turning on and off the full screen. The corresponding images should be _fullscreen and _unfullscreen. In this way, I can unify 1, so I just need to remember the name of one state.
2. The name of id in Xml is suggested to be named directly according to the meaning, without the complicated positioning above, because findViewById is only in find in a specified layout.

Related articles: