Resources and qualifiers

Views, layouts and RecyclerView Junior Kotlin 2.0+ API 24+ Reviewed By Best Latest Apps

Pick the fix

Text stays the same size when users raise the system font size. What's wrong?

Options
Hint 1 of 1

Which unit follows the font size setting?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A Text sizes use dp; switch them to sp

Correct. sp scales with the user's font setting.

Why not the others?
  • B Use px instead. px ignores both density and font scale.
  • C Add a values-large folder. Screen size buckets don't affect font scaling.
  • D Turn off autoSizeText. Not the cause.

30-second answer

Resources live in folders with qualifiers like values-de, layout-w600dp or drawable-night. At runtime, Android picks the best match for the current configuration: language, screen width, density, night mode and more. Use dp for sizes, which scale with density, and sp for text, which also scales with the user's font size setting.

Practise saying it · 30 s. No recording, just a timer

Explain resources, dp and sp.

Say your answer out loud, then check which of these points you covered:

  • Qualifiers pick the best match
  • dp for sizes, sp for text
  • Width qualifiers for large screens
  • Test large fonts

Deep dive

Width qualifiers (w600dp) beat old large/xlarge buckets for tablets and foldables.

Vector drawables avoid shipping PNGs per density.

Don't hardcode strings; strings.xml with plurals and placeholders supports translation.

Since Android 14, font scaling is non-linear up to 200%, so test large font sizes.

Common mistakes

  • Using px for layout sizes.
  • Using dp for text, which ignores the user's font size.
  • Using screen-size buckets instead of width qualifiers.

Senior take & follow-ups

Mention accessibility (sp, large fonts) and modern width qualifiers.

Follow-up questions

Think of your answer first, then open the hint.

  1. Why use sp for text?

    Show hint

    It respects the user's font size choice.

  2. How do you provide a tablet layout?

    Show hint

    A layout-w600dp folder or window size classes in Compose.

Free tool

Android adaptive icon generator

Free tool: make adaptive, round, themed and Play Store icons for every density bucket, with a safe-zone overlay.

Suggest a fix if something here is wrong or out of date.