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

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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
 

Recently uploaded (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 

Make your app dance with MotionLayout