Skip to content


[Predictive Back] Add top-level developer documentation
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 519208554
  • Loading branch information
dsn5ft committed Mar 24, 2023
1 parent 30ea33e commit 8105cb7
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions docs/foundations/
@@ -0,0 +1,59 @@
title: "Predictive Back"
layout: detail
section: foundations
excerpt: "Predictive Back"
iconId: predictive_back
path: /foundations/predictive_back/

# Predictive Back

Predictive Back is a navigation pattern tied to gesture navigation which shows
the user a glimpse of where swiping back will bring them. Before completing a
swipe, the user can decide to continue to the previous view or stay in the
current view.

In Android T (13), the OS introduced support for predictive back-to-home, which
shows the user a preview of the home screen when swiping back to exit an app.

With Android U (14), the OS adds support for in-app predictive back, which apps
can take advantage of to show the user previous destinations when swiping back
within the app itself.

## Design & API documentation

- Material Design guidelines: Predictive Back (coming soon)
- [Framework & AndroidX Predictive Back developer guide](

## Usage

To opt in to predictive back, apps must:

1. Migrate from the legacy back handling APIs (`Activity#onBackPressed`,
`KeyEvent.KEYCODE_BACK`, etc.) to the more recently introduced "back callback"
APIs (`OnBackAnimationCallback`, `OnBackPressedCallback`, etc.). This involves
flipping the `android:enableOnBackInvokedCallback` manifest flag to `true`, and
registering callbacks to handle back pressed on Android T and above. More
details on this general back migration can be found at the
[Framework & AndroidX Predictive Back developer guide](

2. Upgrade to MDC-Android library version **1.10.0-alpha01 (coming soon)** or

Once completing these steps, you will get most of the predictive back animations
within Material Components for free on Android U devices. See the section below
to understand which components support predictive back and to learn about
special considerations for each component.

### Predictive Back Material Components

The following Material Components support predictive back behavior and

- Search bar
- Bottom sheet
- Side sheet (support coming soon)
- Navigation drawer
- Navigation bar / Bottom navigation view (support coming soon)
- Navigation rail (support coming soon)

0 comments on commit 8105cb7

Please sign in to comment.