SlideShare a Scribd company logo
1 of 22
Make your app dance with MotionLayout
LINE TV
Timmy
Android Taipei 20181129
What is MotionLayout
● Is new layout manage motion and widget animation in application
● ConstraintLayout subclass
● A mix between the property animation framework, layout transitions with
TransitionManager, and CoordinatorLayout.
● Fully declarative
Preview Tool
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.constraint.motion.MotionLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutDescription="@xml/...">
activity_drama_page.xml
<android.support.v4.widget.SwipeRefreshLayout>
<android.support.constraint.motion.MotionLayout
app:layoutDescription="@xml/drama_page">
// All Child View
<View ... />
<TextView ... />
</android.support.constraint.motion.MotionLayout>
</android.support.v4.widget.SwipeRefreshLayout>
title bar
tab
ec_list
Case 1
<Transition
app:constraintSetEnd="@id/collapsed"
app:constraintSetStart="@id/expanded"
app:duration="300">
<OnSwipe
app:dragDirection="dragUp"
app:touchAnchorId="@id/tabs"
app:touchAnchorSide="top"/>
</Transition>
Case 1
<ConstraintSet
android:id="@+id/expanded">
<Constraint
android:id="@id/bar">
<CustomAttribute
app:attributeName="backgroundColor"
app:customColorValue="#00000000"/>
</Constraint>
<Constraint
android:id="@id/title"
android:alpha="0"/>
<Constraint
android:id="@id/tabs"
app:layout_constraintTop_toBottomOf="@+id/ec_list"/>
</ConstraintSet>
Case 1
<ConstraintSet
android:id="@+id/collapsed">
<Constraint
android:id="@id/bar">
<CustomAttribute
app:attributeName="backgroundColor"
app:customColorValue="#FFFFFFFF"/>
</Constraint>
<Constraint
android:id="@id/title"
android:alpha="1"/>
<Constraint
android:id="@id/tabs"
app:layout_constraintTop_toBottomOf="@+id/bar"/>
</ConstraintSet>
favorite
poster
Case 2
<ConstraintSet
android:id="@+id/expanded">
<Constraint
android:id="@id/poster"
app:layout_constraintTop_toTopOf="parent"/>
<Constraint
android:id="@id/favorite"
android:visibility="visible"/>
</ConstraintSet>
Case 2
<ConstraintSet
android:id="@+id/collapsed">
<Constraint
android:id="@id/poster"
app:layout_constraintBottom_toTopOf="parent"/>
<Constraint
android:id="@id/favorite"
android:visibility="invisible"/>
</ConstraintSet>
bar
back media_route_button
title
poster_vertical
poster_guideline
Case 3
<ConstraintSet
android:id="@+id/expanded">
<Constraint
android:id="@id/title"
app:layout_constraintStart_toEndOf="@+id/poster_vertical"
app:layout_constraintTop_toBottomOf="@+id/poster_guideline"/>
</ConstraintSet>
Case 3
<ConstraintSet
android:id="@+id/collapsed">
<Constraint
app:layout_constraintBottom_toBottomOf="@+id/bar"
app:layout_constraintEnd_toStartOf="@+id/media_route_button"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@+id/back"
app:layout_constraintTop_toTopOf="@+id/bar"/>
</ConstraintSet>
<Transition
<OnSwipe ... />
<KeyFrameSet>
<KeyPosition
app:framePosition="50"
app:keyPositionType="deltaRelative"
app:percentX="0.1"
app:percentY="0.9"
app:target="@id/drama_info_bar_title"/>
</KeyFrameSet>
</Transition>
Summary
● In alpha
● Scroll nesting scroll
● Reduce layout hierarchy
● Keep in mind that adding motion in your application should be meaningful;
don’t over do it!
Reference
https://github.com/googlesamples/android-ConstraintLayoutExamples
https://developer.android.com/reference/android/support/constraint/motion/Motion
Layout
https://medium.com/google-developers/introduction-to-motionlayout-part-i-
29208674b10d
https://www.youtube.com/watch?v=ytZteMo4ETk&feature=youtu.be&t=28m45s
Q & A

More Related Content

What's hot

Android Layout 3分クッキング
Android Layout 3分クッキングAndroid Layout 3分クッキング
Android Layout 3分クッキングYuki Anzai
 
Salesforce1 Adoption Workshop - Silicon Valley User Group
Salesforce1 Adoption Workshop - Silicon Valley User GroupSalesforce1 Adoption Workshop - Silicon Valley User Group
Salesforce1 Adoption Workshop - Silicon Valley User GroupDeepa Patel
 
Latest Blogging Trend: Mobile App For A Better Connectivity With The Audience
 Latest Blogging Trend: Mobile App For A Better Connectivity With The Audience Latest Blogging Trend: Mobile App For A Better Connectivity With The Audience
Latest Blogging Trend: Mobile App For A Better Connectivity With The AudienceExcellent Webworld
 
Trademob - Business Insider MadConf
Trademob - Business Insider MadConfTrademob - Business Insider MadConf
Trademob - Business Insider MadConfJulie Hansen
 
Flurry App Circle Mobile Monday
Flurry App Circle Mobile MondayFlurry App Circle Mobile Monday
Flurry App Circle Mobile Mondayspgalligan
 
4 Ways to Build an App Without Code | AppSheet
4 Ways to Build an App Without Code | AppSheet4 Ways to Build an App Without Code | AppSheet
4 Ways to Build an App Without Code | AppSheetAppSheet
 

What's hot (12)

Android Layout 3分クッキング
Android Layout 3分クッキングAndroid Layout 3分クッキング
Android Layout 3分クッキング
 
Salesforce1 Adoption Workshop - Silicon Valley User Group
Salesforce1 Adoption Workshop - Silicon Valley User GroupSalesforce1 Adoption Workshop - Silicon Valley User Group
Salesforce1 Adoption Workshop - Silicon Valley User Group
 
Latest Blogging Trend: Mobile App For A Better Connectivity With The Audience
 Latest Blogging Trend: Mobile App For A Better Connectivity With The Audience Latest Blogging Trend: Mobile App For A Better Connectivity With The Audience
Latest Blogging Trend: Mobile App For A Better Connectivity With The Audience
 
Rails engines
Rails enginesRails engines
Rails engines
 
Progress im seminar
Progress im seminarProgress im seminar
Progress im seminar
 
Trademob - Business Insider MadConf
Trademob - Business Insider MadConfTrademob - Business Insider MadConf
Trademob - Business Insider MadConf
 
Flurry App Circle Mobile Monday
Flurry App Circle Mobile MondayFlurry App Circle Mobile Monday
Flurry App Circle Mobile Monday
 
AppPrizes
AppPrizesAppPrizes
AppPrizes
 
Chapter 5 - Layouts
Chapter 5 - LayoutsChapter 5 - Layouts
Chapter 5 - Layouts
 
PWAs overview
PWAs overview PWAs overview
PWAs overview
 
4 Ways to Build an App Without Code | AppSheet
4 Ways to Build an App Without Code | AppSheet4 Ways to Build an App Without Code | AppSheet
4 Ways to Build an App Without Code | AppSheet
 
Mobile or Bust
Mobile or BustMobile or Bust
Mobile or Bust
 

Similar to Make your app dance with MotionLayout

Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?Brenda Cook
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
Android Layout
Android LayoutAndroid Layout
Android Layoutmcanotes
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screenMatteo Bonifazi
 
Lecture #1 Creating your first android project
Lecture #1  Creating your first android projectLecture #1  Creating your first android project
Lecture #1 Creating your first android projectVitali Pekelis
 
Android Apps Development Basic
Android Apps Development BasicAndroid Apps Development Basic
Android Apps Development BasicMonir Zzaman
 
Android JetPack: easy navigation with the new Navigation Controller
Android JetPack: easy navigation with the new Navigation ControllerAndroid JetPack: easy navigation with the new Navigation Controller
Android JetPack: easy navigation with the new Navigation ControllerLeonardo Pirro
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in androidInnovationM
 
iOS Transition Animations The proper way to do it.pdf
iOS Transition Animations The proper way to do it.pdfiOS Transition Animations The proper way to do it.pdf
iOS Transition Animations The proper way to do it.pdfSatawareTechnologies4
 
Android animation made easy with MotionLayout at Android bangkok conference 2020
Android animation made easy with MotionLayout at Android bangkok conference 2020Android animation made easy with MotionLayout at Android bangkok conference 2020
Android animation made easy with MotionLayout at Android bangkok conference 2020Abdulrohim sama
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Share kmu itbz_20181106
Share kmu itbz_20181106Share kmu itbz_20181106
Share kmu itbz_20181106DongHyun Gang
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and ContainerOum Saokosal
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談awonwon
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design LibraryTaeho Kim
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
The ultimate guide to optimize your react native app performance in 2022
The ultimate guide to optimize your react native app performance in 2022The ultimate guide to optimize your react native app performance in 2022
The ultimate guide to optimize your react native app performance in 2022Katy Slemon
 

Similar to Make your app dance with MotionLayout (20)

Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Android Layout
Android LayoutAndroid Layout
Android Layout
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screen
 
Lecture #1 Creating your first android project
Lecture #1  Creating your first android projectLecture #1  Creating your first android project
Lecture #1 Creating your first android project
 
Android Apps Development Basic
Android Apps Development BasicAndroid Apps Development Basic
Android Apps Development Basic
 
Android JetPack: easy navigation with the new Navigation Controller
Android JetPack: easy navigation with the new Navigation ControllerAndroid JetPack: easy navigation with the new Navigation Controller
Android JetPack: easy navigation with the new Navigation Controller
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in android
 
Layouts in android
Layouts in androidLayouts in android
Layouts in android
 
iOS Transition Animations The proper way to do it.pdf
iOS Transition Animations The proper way to do it.pdfiOS Transition Animations The proper way to do it.pdf
iOS Transition Animations The proper way to do it.pdf
 
Android animation made easy with MotionLayout at Android bangkok conference 2020
Android animation made easy with MotionLayout at Android bangkok conference 2020Android animation made easy with MotionLayout at Android bangkok conference 2020
Android animation made easy with MotionLayout at Android bangkok conference 2020
 
android layouts
android layoutsandroid layouts
android layouts
 
Share kmu itbz_20181106
Share kmu itbz_20181106Share kmu itbz_20181106
Share kmu itbz_20181106
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design Library
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
The ultimate guide to optimize your react native app performance in 2022
The ultimate guide to optimize your react native app performance in 2022The ultimate guide to optimize your react native app performance in 2022
The ultimate guide to optimize your react native app performance in 2022
 
06 UI Layout
06 UI Layout06 UI Layout
06 UI Layout
 
Constraint layout - New Hope
Constraint layout - New HopeConstraint layout - New Hope
Constraint layout - New Hope
 

Recently uploaded

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Make your app dance with MotionLayout