Sample material transition animations for Android

Overview

See ListOfThings for a newer implementation.

Android Material Transitions

This Android project samples some Material Design-ish transitions for list items and floating action buttons. It uses the the shared element concept introduced in Android 5.0. I tried to pull it off with pure fragment transitions and ran into a few stags (see below) so my current solution uses an activity transition for each step.

[[MORE]]

Activity Transition tricks:

  • Generate a background bitmap immediately before the transition and pass it to the called activity
  • Suppress the view overaly (used by default for activity transitions) to keep shared elements behind the toolbar & system bars
  • Fall back to fade and scale activity transitions when < 5.0

Fragment Transition issues:

  • animating a shared element appears to only work when using .replace() - not .add()
  • Unlike Activity transitions, the view overlay is not used for fragment transitions so shared elements might animate behind other views (especially when reversing a transition). setElevation() helps some of the time.
  • if transitionName is set at runtime (with java - not xml) it may not survive all lifecycle events. E.g. when returning to a fragment from popBackStack()
  • On Activity transitions the second activity's elements are animated when the transition is played forward AND when reversed. For Fragment transitions, the second activity's elements are animated when played forward but the first activity's elements are animated when reversed.

More Help

License

Copyright 2015 Todd Way

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
A sample app illustrating Android development using Kotlin with MVVM architecture, Android Jetpack, and other commonly used libraries.

Anime Facts A sample app illustrating Android development using Kotlin with MVVM architecture, Android Jetpack, and other commonly used libraries. Ani

Android app which fetches a sample movies list to display. Built using Kotlin and latest Android tech stack, with an approach to clean architecture.
Android app which fetches a sample movies list to display. Built using Kotlin and latest Android tech stack, with an approach to clean architecture.

movies-sample-app This is an Android app which fetches a sample movies list to display. Built using Kotlin and latest Android tech stack, with an appr

This is a sample Android project that presents a modern approach to Android application development.

Movies It is a sample app that shows information about movies and series. The goal is build a scalable, maintainable and testable app, implementing go

Android-splash-screen-demo - Sample application to demo the various features provided in android-splash-screen
Android-splash-screen-demo - Sample application to demo the various features provided in android-splash-screen

Android Splash screen API demo This is a sample application used to demonstrate the various features provided in android-splash-screen. More details c

📚  Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.

Android Components Architecture in a Modular Word Android Components Architecture in a Modular Word is a sample project that presents modern, 2020 app

Sample Project for Android Support Library 23.2
Sample Project for Android Support Library 23.2

SnapShot: Contains features Vector Drawable Animated Vector Drawable AppCompat DayNight theme Bottom Sheets Using BottomSheetDialog in day-night mode.

A sample Android app which showcases advanced usage of Dagger among other open source libraries.
A sample Android app which showcases advanced usage of Dagger among other open source libraries.

U+2020 A sample Android app which showcases advanced usage of Dagger among other open source libraries. Watch the corresponding talk or view the slide

Sample application demonstrating Android design and animation
Sample application demonstrating Android design and animation

android-movies-demo This is a sample application showing off some interesting design/development interactions for a talk given at Droidcon 2013. As it

This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...

Android L preview example Description This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shad

Comments
  • Clicking on half visible item

    Clicking on half visible item

    Clicking on a half visible item where the rest is hidden below the actionbar causes the element to jump in front of the actionbar before the transition begins.

    Is there a way to fix this?

    opened by leicht-io 0
  • java.lang.RuntimeException: Performing stop of activity that is not resumed

    java.lang.RuntimeException: Performing stop of activity that is not resumed

    Hi. Have you ever come across this exception when using activity/fragment transitions? It happens on Xperia Z3 compact running Android 5.1.1. I'm unable to produce it with your app, but I've used the TransitionHelper class to do achieve similar effects in my app and it's throwing this exception. The difference is my target activity has more complex layouts, but the exception sometimes happens even on first launch of the app right before starting the transition.

    Just thought you might have some insight. Thanks.

    opened by sebouh00 0
Owner
Todd Way
Todd Way
🛡️ Android security (camera/microphone dots indicators) app using Hilt, Animations, Coroutines, Material, StateFlow, Jetpack based on MVVM architecture.

??️ Android security app using Hilt, Animations, Coroutines, Material, StateFlow, Jetpack (Room, ViewModel, Paging, Security, Biometrics, Start-up) based on MVVM architecture.

null 639 Jan 6, 2023
A simple material design app intro with cool animations and a fluent API.

material-intro A simple material design app intro with cool animations and a fluent API. Very inspired by Google's app intros. Demo: A demo app is ava

Jan Heinrich Reimer 1.7k Jan 7, 2023
:octocat: A demo project based on MVVM architecture and material design & animations.

GithubFollows A simple demo project based on MVVM clean architecture and material design & animations. Architecture Specs & Open-source libraries Mini

Jaewoong Eum 288 Dec 25, 2022
🎬 A demo project for The Movie DB based on Kotlin MVVM architecture and material design & animations.

TheMovies A simple project for The Movie DB based on Kotlin MVVM clean architecture and material design & animations. How to build on your environment

Jaewoong Eum 420 Nov 29, 2022
🎬 A demo project using The Movie DB based on Kotlin MVVM architecture and material design & animations.

TheMovies2 A simple project using The Movie DB based on Kotlin MVVM architecture and material designs & animations. How to build on your environment A

Jaewoong Eum 450 Jan 2, 2023
Shreyas Patil 2.1k Dec 30, 2022
📱 Android Library to implement Rich, Beautiful, Stylish 😍 Material Navigation View for your project with Material Design Guidelines. Easy to use.

Material NavigationView for Android ?? ?? Android Library to implement Rich, Beautiful Material Navigation View for your project with Material Design

Shreyas Patil 198 Dec 17, 2022
An android library through which users can add a customized loading dialog box with Lottie Animations.

CustomLottieDialogBox About CustomLottieDialogBox is an android library which facilitate developers to add customized loading Dialog-Boxes to their an

Siddharth Singh 7 Aug 10, 2022
A demo of the power menu with Reveal and other animations

MaterialPowerMenu A demo of the power menu with Reveal and other animations Some days ago, I saw a gif on Google+ demonstating a concept of Android Po

Naman Dwivedi 888 Oct 11, 2022
FoldingNavigationDrawer-Android This is a sample project present how to use Folding-Android to add Folding Efect to Navigation Drawer.

FoldingNavigationDrawer-Android Sample (Play Store Demo) This is a sample project present how to use Folding-Android to add Folding Efect to Navigatio

null 242 Nov 25, 2022