Android resource naming rules
In recent months, a lot of work has been involved in android resources. For complex applications, resource naming rules are necessary. In addition to developers, the uidesigner (or the person related to the cut chart) also needs to be very clear about the resource usage location, so that the communication will be direct. The disadvantage is that the resource name is longer, but the overall value is worth it.
Naming template: Abbreviation _ main interface _ FUNCTION Section
(1) Abbreviations:
Ic ---------------------- icon
Bg --------------------- background
Di ---------------------- divider
Sl ----------------------- selector
Cl ----------------------- color
Bt ---------------------- button
Ic is mainly used for app icons
Bg is mainly used for la S and sub-la S.
Di is mainly used for separation line, including not only divider in Listview, but also line in normal Layout
Sl is mainly used for multiple States of a view, including not only selector in Listview, but also selector of buttons.
Cl is mainly used for color values.
Bt is mainly used for button expression. Sometimes we will hesitate between ic and bt. A simple distinction is the function view. If a view executes the back, confirm, or cancel function, you should use bt
(2) Main Interface:
The main function page is the main Activity of the app. For Browser, such as BrowserActivity, BookmarkActivity, SettingActivity, and AboutActivity.
(3) functions:
That is, the functional areas corresponding to each main interface. Taking BrowserActivity as an example, the functional areas include: 1, titlebar, 2, speedial 3, toolbar, 4, menu, etc.
Note that the function division is based on the Content features displayed on a specific interface. For example, although menus are controlled by toolbar, they are not subdivided under the toolbar.
(4) Suffix
Unit -------------------------- this suffix is used for element images when the xml tilemode is used for image configuration.
Nor ----------------------------- the image status, indicating the normal status
Hl ------------------------------- the picture status, indicating the highlighted status
Press ------------------------- the status of the image, indicating the status of the pressed
Select ---------------------- the status of the image, which indicates that the view it occupies is selected
Unselect ------------------- the status of the image, indicating that the view it occupies is not selected
(5) Others
1. The relative status of the function, such as enabling or disabling full screen. The corresponding image should be _ fullscreen and _ unfullscreen. In this way, you only need to remember the names of one State.
2. Name the id in Xml. We recommend that you name it based on the meaning without using the above complex positioning, because findViewById can only be found in a specified layout.