Skip to content

File format conventions

Jules edited this page Apr 5, 2024 · 4 revisions

All types

  • Format the code in Android Studio.
  • Optimize and compress SVGs with SVGO.
  • Add a newline (empty line) to the end of each file.

XML

To check XML files, make sure to open them in Android Studio in order to receive warnings from the software itself.

  • The XML data should ideally not have any warnings (e.g. LongVector).
    • Try to use avocado to further compress XMLs with long paths.
    • Some shapes are complex and will render long paths no matter how much compression is done. As a last resort, add the attribute tools:ignore="VectorPath" to the culprit <path />. This will also require you to add xmlns:tools="http://schemas.android.com/tools" to the <vector /> itself.
      • Also add VectorRaster to the ignore attribute if tools:targetApi="n" appears in the XML (e.g. tools:ignore="VectorPath,VectorRaster")
  • Avoid android:fillType=“evenOdd” if possible, unless removing this attribute negatively affects the graphic of the icon itself.
    • Make sure to visually check within the preview in Android Studio if removing this attribute causes any issues.
    • If the path of an icon requires this attribute, you should then add the attribute tools:targetApi="n" to the culprit <path />. This will also require you to add xmlns:tools="http://schemas.android.com/tools" to the <vector /> itself.
Clone this wiki locally