mirror of
https://github.com/material-components/material-components-android.git
synced 2026-01-19 19:41:35 +08:00
1.4 KiB
1.4 KiB
General Contributing Guidelines
The Material Components contributing policies and procedures can be found in the main Material Components documentation repository’s contributing page.
Android Additions
The Android team also abides by the following policy items.
Code conventions
Since we all want to spend more time coding and less time fiddling with whitespace, Material Components for Android uses code conventions and styles to encourage consistency. Code with a consistent style is easier (and less error-prone!) to review, maintain, and understand.
Be consistent
If the style guide is not explicit about a particular situation, the cardinal rule is to be consistent. For example, take a look at the surrounding code and follow its lead, or look for similar cases elsewhere in the codebase.
Java
We follow the Google Java Style Guide.
XML
- 2 space indentation
- Resource naming (including IDs) is
lowercase_with_underscores - Attribute ordering:
xmlns:android- other
xmlns: android:idstyleandroid:layout_attributesandroid:paddingattributes- other
android:attributes app:attributestool:attributes