Skip to content

Expert: features and shipping · Permissions, Material 3 and polish · topic 38 of 50 · 30 min

Accessibility and adaptive layouts

Explanation

Accessible apps work for everyone, including people who use TalkBack (the screen reader), large fonts or have low vision. Give images and icons content descriptions, keep touch targets at least 48 dp, use enough colour contrast, use sp for text and test at the largest font size. Adaptive layouts use window size classes to show richer layouts on tablets and foldables.

Why accessibility matters

Millions of people in India live with a visual, hearing or motor disability, and many more are elderly users with weaker eyesight. Android has built-in tools for them: TalkBack reads the screen aloud, font scaling enlarges text, and Switch Access lets people use the phone with buttons. If your app ignores these, those users simply cannot use it. Accessibility also helps everyone: big tap targets and clear contrast are easier for anyone using a phone in bright sunlight or on a moving bus.

Checklist for every screen

RuleHow in Compose
Describe meaningful images and iconscontentDescription = "Add to cart"; null for decorative ones
Touch targets at least 48 x 48 dpMaterial components do this; for custom clickables use Modifier.minimumInteractiveComponentSize() or size(48.dp)
Enough colour contrastUse theme on-colours; aim for at least 4.5:1 for normal text
Text that can growUse sp and avoid fixed heights that cut off large text
Do not rely on colour aloneAdd text or icons, for example "Failed" next to a red mark

Semantics

Compose builds a semantics tree alongside the UI: a description of what each element means, which TalkBack and UI tests read. Most components fill it in automatically. You can merge a group into one announcement or add meaning to custom elements with Modifier.semantics.

kotlin
Row(
    Modifier
        .clickable(onClick = onOpen)
        .semantics(mergeDescendants = true) { }       // read the row as one item
        .padding(16.dp)
) {
    Icon(Icons.Default.Star, contentDescription = null)   // decorative
    Text("4.5 rating")
    Text("Annapurna Mess, 1.2 km")
}
TalkBack announces "4.5 rating, Annapurna Mess, 1.2 km" as one item instead of three separate stops.

Testing it yourself

  1. Turn on TalkBack in Settings > Accessibility and try to complete your main task with your eyes closed.
  2. Set font size and display size to the largest values and check nothing is cut off.
  3. Use Accessibility Scanner (a free Google app) to find small targets and low contrast.
  4. Check the Play Console pre-launch report, which flags common accessibility issues.

Adaptive layouts

Android runs on phones, foldables, tablets and Chromebooks. Stretching a phone layout across a tablet wastes space. Window size classes group window widths into Compact (most phones in portrait), Medium (small tablets, unfolded foldables) and Expanded (large tablets, desktop). Your layout chooses a structure per class.

kotlin
@Composable
fun MailApp(windowSizeClass: WindowSizeClass) {
    when (windowSizeClass.windowWidthSizeClass) {
        WindowWidthSizeClass.COMPACT -> SingleColumnInbox()            // list, then details on a new screen
        else -> Row { InboxList(Modifier.weight(1f)); MessagePane(Modifier.weight(2f)) }   // list + details side by side
    }
}
Get the class with currentWindowAdaptiveInfo().windowSizeClass from the material3 adaptive library; check the current docs for exact APIs.

Material 3 also offers adaptive components such as NavigationSuiteScaffold, which shows a bottom bar on phones and a navigation rail on wider screens automatically.

Think of it like this: An accessible app is like a building with ramps, lifts, Braille buttons and clear signboards. They cost a little planning, but they let everyone in, including the delivery person with a heavy trolley who is not "disabled" at all.

Common mistakes

  • Tiny custom icons as buttons (24 dp) with no padding: hard to tap.
  • Text in fixed-height boxes that gets cut off at large font sizes.
  • Status shown only by colour (green/red dot).
  • Designing only for one phone size and never testing in landscape or on a tablet emulator.

Need help?

Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.

Try:

Watch the lesson

Accessibility and adaptive layouts · 1/6

TalkBack | Large fonts

Accessible apps work for everyone, including screen reader users and people who use large fonts.

Prefer a video by a teacher? Find free videos on “jetpack compose accessibility talkback semantics window size class” on YouTube ↗

In real life: A bank app that elderly users can use

A bank's app is used by many senior citizens. The team tests every release with the largest font size and with TalkBack, gives every icon a clear description ("Show balance", "Scan QR"), keeps buttons large, and labels transaction status with words ("Successful", "Failed") as well as colour. On tablets, the account list and transaction details appear side by side.

kotlin
IconButton(onClick = onToggleBalance) {
    Icon(
        imageVector = if (hidden) Icons.Default.Visibility else Icons.Default.VisibilityOff,
        contentDescription = if (hidden) "Show balance" else "Hide balance",
    )
}
The description changes with the state, so TalkBack always says what tapping will do.

Practice (0/3 done)

Task 1 · Question

What is the recommended minimum touch target size on Android?

Task 2 · Question

A payment status is shown only as a green or red dot. What is the accessibility problem?

Task 3 · Practice

Audit one of your apps: turn on TalkBack and complete the main task with eyes closed, set the largest font size, and run Accessibility Scanner. Fix at least three problems (descriptions, target sizes, cut-off text, colour-only status). Then add a two-pane layout for Expanded width.

Quick quiz

Question 1

1.What is TalkBack?

Question 2

2.What does mergeDescendants = true in semantics do?

Question 3

3.Which window width class do most phones in portrait have?

Question 4

4.Which tool from Google scans an app for accessibility problems on the device?

Read more (free)

Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.

What is TalkBack?

Answer: Android's built-in screen reader

It reads the screen aloud.

What does mergeDescendants = true in semantics do?

Answer: Lets TalkBack read a group as one item

Grouping reduces the number of stops.

Which window width class do most phones in portrait have?

Answer: Compact

Phones in portrait are Compact.

Which tool from Google scans an app for accessibility problems on the device?

Answer: Accessibility Scanner

Accessibility Scanner suggests fixes.

What is the difference between responsive and adaptive?Related

Answer: Responsive fits the space; adaptive also fits platform conventions and input

Both matter on multi-platform apps.

From Responsive and adaptive design

What does dp stand for and why use it?Related

Answer: Density-independent pixels; sizes look similar on all screens

dp scales with screen density.

From Composables and modifiers

What is a screen reader?Related

Answer: Software that reads the page aloud

Screen readers turn the page into speech (or braille) for blind and low-vision users.

From Accessibility basics

What contrast ratio does WCAG AA need for normal-size body text?Related

Answer: 4.5:1

Normal text needs at least 4.5:1. Large text and parts of controls need at least 3:1.

From Accessibility in depth: keyboard, ARIA and WCAG

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

Next steps

  1. This is the last topic of “Permissions, Material 3 and polish”. The module exam comes next.
  2. Module 9 exam: Permissions, Material 3 and polish · 13 questions · 25 min, without help. 4 topics of this module still to finish first.
  3. Then the next module, Testing Android apps. 50 topics left in the course before the final exam.

← Previous: Material components