You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add edge-to-edge layout examples for Android (#9711)
## Summary
- Add edge-to-edge layout example to examples app with system insets
handling
- Add edge-to-edge layout example to Compose app with system insets
handling
- Fix ExampleScaffold in compose-app to prevent TopAppBar overlap with
status bar
### NB:
- Target API: For simplicity, these examples target Android 15+ (API
35). Starting with this version, edge-to-edge display is enforced by
default for all apps (see: [Android 15 Behavior Changes
(https://developer.android.com/about/versions/15/behavior-changes-15#edge-to-edge)).
- Backward Compatibility: I have included links to official Google
documentation for supporting edge-to-edge on apps targeting API 34 or
lower.
## Details
### New Examples
Added edge-to-edge examples demonstrating handling of system insets
(status bars, navigation bars, display cutouts) to prevent map ornaments
from being obscured:
Both examples include:
- System bar appearance configuration -- dark icons, transparent
navigation bar (for 3 buttons navigation).
- Display cutout handling
- Proper margin application to all map ornaments (logo, attribution,
compass, scale bar)
- Comprehensive documentation explaining Android 15+ edge-to-edge
enforcement
### Compose App Fix
Updated `ExampleScaffold.kt` to handle edge-to-edge layout properly to
prevent status bar overlap with app bar
This fixes the issue where the TopAppBar was being obscured by the
system status bar in edge-to-edge mode, which is enforced by default on
Android 15 (API 35+):
Before the fix:
<img width="892" height="772" alt="Screenshot 2026-01-30 at 14 25 24"
src="https://github.com/user-attachments/assets/dd26d37a-deb3-4dc2-b0ef-8a258ce568c8"
/>
After fix:
<img width="1431" height="560" alt="Screenshot 2026-01-30 at 14 28 06"
src="https://github.com/user-attachments/assets/a74d4ed4-531c-4108-8d71-bbdc0cd52c25"
/>
## How to test:
- Launch both edge-to-edge examples on devices with:
- Android 15+ (edge-to-edge enforced)
- Various display cutout configurations (notches, punch-holes)
- 3-button vs gesture navigation
- Verify map ornaments are not obscured by system UI
- Verify TopAppBar in compose-app examples is properly positioned below
status bar
Android 16 App:
NB: screen recording is done with Pixel 3 emulator, which has camera cut
out left top corner, which adds extra inset:
<img width="380" height="778" alt="Screenshot 2026-02-02 at 9 26 04"
src="https://github.com/user-attachments/assets/a0c18ff7-b476-4a72-b431-22cdc775fd9b"
/>
[e-t-e-app.webm](https://github.com/user-attachments/assets/484fdb65-ce98-4e1e-91c5-450e577384a5)
Android 16 Compose App:
NB: screen recording is done with Pixel 3 emulator, which has camera cut
out left top corner, which adds extra inset.
<img width="384" height="779" alt="Screenshot 2026-02-02 at 9 25 31"
src="https://github.com/user-attachments/assets/d4f4115b-9531-4e70-b26f-2c4d8a119fdf"
/>
[e-t-e-compose.webm](https://github.com/user-attachments/assets/567e91e5-bcbd-4657-87cd-66aea82db09d)
cc @mapbox/maps-android
---------
Co-authored-by: natiginfo <natig.babayev@mapbox.com>
GitOrigin-RevId: ddfa3de08dbf7ba3c6e43a8b72338002c3a1b477
Copy file name to clipboardExpand all lines: app/src/main/res/values/example_descriptions.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -117,5 +117,5 @@
117
117
<stringname="description_data_join">Showcase join JSON data with vector tiles and style it.</string>
118
118
<stringname="description_3d_model_source_interactions_label">3D model with source-driven interactions</string>
119
119
<stringname="description_3d_model_source_interactions">Use a model layer and source to interactively change material and orientation of model parts.</string>
120
-
120
+
<stringname="description_edge_to_edge">Showcase edge-to-edge layout with proper handling of system insets (system bars, navigation bars, and display cutouts).</string>
0 commit comments