The best foldable adaptation know-how from around the web. Each entry is a short summary in our words with a link to the original, so the credit stays with the author.
No resources match these filters. Try another topic or clear the filters.
Skills
Repos that do the adapting for you: agent skills, libraries and samples on GitHub.
androidx/androidx · Android Open Source Project · ★ 6.1K
The AndroidX repository contains the Compose Material 3 Adaptive libraries used to arrange content across changing window sizes on foldables. Its list-detail scaffold supports one, two or three panes, with optional pane expansion, while Navigation 3 integration maps navigation entries into those panes. This entry concerns the compose/material3/adaptive modules within the wider Jetpack repository.
Google’s Android sample projects include list-detail, feed and supporting-pane layouts in Compose and Views for phones, tablets and foldables. The repository also contains adaptive media and navigation examples for comparing implementation patterns as screen space changes. Start with the CanonicalLayouts directory for side-by-side content.
Google’s Android agent-skill collection includes a dedicated adaptive UI workflow for Compose apps. The adaptive skill covers multi-pane layouts, preserving UI and media state through folding or resizing, and tabletop layouts for foldable devices. It assumes Compose screens and Navigation 3, so those prerequisites should be checked before applying the instructions.
Google’s adaptive quality framework distinguishes basic full-window support, optimized layouts and experiences that use device-specific features. Its checklists cover foldable postures, multitasking and external input, with linked tests and a device matrix. Developers can select the requirements that apply to their app rather than treating every guideline as universal.
React Native’s Dimensions reference explicitly warns that folding can change window and screen size after startup. It recommends useWindowDimensions for React components, or a change listener where Dimensions is needed, so rendering does not keep stale cached values. This covers resizing inputs rather than hinge geometry or device-specific fold APIs.
Flutter’s MediaQueryData reference explains how display features describe hinges, creases and cutouts in the coordinate space spanning the active screens. Feature type distinguishes an obstruction from a fold, while feature state exposes posture. The documentation explicitly limits this populated list to Android, so this entry does not imply equivalent iOS or HarmonyOS behavior.
Flutter’s DisplayFeatureSubScreen places content in a sub-screen that avoids an obstructing display feature or half-open fold. It chooses the region nearest anchorPoint, with a Directionality fallback, and adjusts the child’s MediaQuery coordinates and padding. This complements the existing display-feature reference; hardware feature data is currently populated on Android.
Google’s Camera2 guide explains how folding can change the active physical sensor behind a logical camera, including its orientation and lens facing. It recommends monitoring the active physical ID and re-reading camera characteristics instead of caching them, then updating preview transforms when the sensor changes. CameraX remains the suggested default when low-level Camera2 control is unnecessary.
This foldable-specific quality checklist pairs posture, camera and multitasking requirements with named tests. It covers controller placement in tabletop mode, front and back camera previews, picture-in-picture, attachments and multiple app instances. The detailed scenarios complement the broader adaptive-quality tiers already in the Kit.
Google’s Compose recipe explains how folding or resizing can disrupt scroll position and the state of individual list items. It uses rememberLazyListState() for list position and rememberSaveable for stateful elements such as text inputs. The example separates list-level state from item-level state so an unfolding transition can preserve both.
Google explains window bounds, lifecycle callbacks and access to shared resources when apps run alongside one another. Its multi-instance section specifically describes how folding a device can background or terminate one of two app instances. WindowMetrics, multi-window callbacks and the verification checklist help separate resizing behavior from single-window pane layouts.
This codelab adapts a legacy multi-activity app to a two-pane layout using XML rules or Jetpack WindowManager APIs. It then uses SplitController and a split attributes calculator to respond to changes in window or device state, including folding and tabletop posture. The walkthrough also switches between a navigation rail and bottom navigation as the available space changes.
Google explains how folded, flat and tabletop postures affect the arrangement of content and controls. The hinge guidance recommends considering where text and controls sit and allowing a wider gutter in pane-based layouts. Cover-screen and orientation examples help designers adapt a focused experience without assuming that every foldable supports every posture.
Google’s official guide to reading fold state with Jetpack WindowManager. It shows how to get a FoldingFeature, tell whether the device is flat or half-opened, and check whether the hinge splits the window. From there you can design for tabletop (half-open, hinge horizontal) and book (half-open, hinge vertical) postures instead of letting content fall into the crease.
This guide separates visual layout checks from state-restoration tests when a foldable changes size or configuration. It explains using StateRestorationTester or Activity.recreate() to exercise restoration, and distinguishes those checks from posture-specific tests that need a suitable foldable device or emulator. It also covers UI behavior and screenshot tests for layout regressions.