Material Design Dialog Icons for Android — Examples & Assets

Optimizing Android Dialog Icons: Sizes, Formats, and Tips

1) Purpose & placement

  • Dialog icons clarify intent (error, warning, info, success) and draw attention without overwhelming content.
  • Place icons left of text or above title depending on dialog style; keep them visually secondary to the message.

2) Sizes and density guidance

  • Use scalable vectors (preferred) or multiple raster sizes for density buckets.
  • Common sizes (recommended as baseline visual sizes, adapt to design):
    • Small inline icon: 16–20 dp
    • Dialog title/leading icon: 24–32 dp
    • Large centered icon (illustrative): 48–64 dp
  • Provide assets for Android density buckets (if using PNGs): mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi with scale factors 1x, 1.5x, 2x, 3x, 4x.

3) Formats

  • Preferred: Vector Drawable (XML / SVG converted to VectorDrawable) — scales crisply, smaller APK size, easy to tint.
  • Acceptable raster formats: PNG (lossless) for legacy or complex bitmap art; provide density-specific versions.
  • Avoid large JPGs; use PNG or webp for raster when supported (webp can reduce size).

4) Coloring and theming

  • Use single-color (monochrome) or limited palette so icons are easily tintable.
  • Follow Material color roles: use semantic colors (error, warning, primary, on-surface) rather than hard-coded hex.
  • Support light and dark themes: use tints or provide separate assets if icon has multi-color details.

5) Accessibility & contrast

  • Ensure icon contrast ratio against background meets accessibility guidelines (WCAG AA ideally >4.5:1 for small elements; use larger sizes or stronger contrast if needed).
  • Provide contentDescription for screen readers; if icon is decorative and redundant with text, mark it as null (android:contentDescription=“@null”).

6) Performance and size

  • Prefer VectorDrawable to reduce APK size and avoid multiple raster files.
  • For animations, use AnimatedVectorDrawable or Lottie for richer motion with manageable size.
  • Compress raster assets (lossless or webp) and remove unused assets.

7) Implementation tips

  • Use AppCompat/Material components to automatically apply tints and theme colors.
  • Inflate icons in XML via android:src or app:icon for Material dialogs; for VectorDrawables use android:drawableTint or tint attributes.
  • Keep padding consistent: align icon baseline with title text or center it visually (use 8–16 dp spacing).
  • Test on multiple screen sizes and densities; check dialogs stacked over different backgrounds.

8) Examples & checklist

  • File types: VectorDrawable XML + optional PNGs for legacy.
  • Sizes provided: 24dp, 32dp, 48dp (with density variants for PNGs).
  • Theme support: tintable, dark/light-ready.
  • Accessibility: contentDescription present or null if decorative; adequate contrast.
  • Performance: optimized file sizes; animated icons only when meaningful.

If you want, I can generate a ready-to-use VectorDrawable template for a common dialog icon (info, warning, or error).

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *